Game Development Community

[resolved] HUD and linking it to the camera position

by rennie moffat · in Torque Game Builder · 03/09/2010 (11:50 am) · 0 replies

###edit. please ignore or use for reference. I just changed, %this.getCurrentCameraPosition() to sceneWindow2D.getCurrentCameraPosition().

I am trying to make a HUD, so my hud objects, time, map etc need to be a slave to the camera position. I thought that if I call the %this.getCameraPosition() set it to a variable then use that variable plus an offset to dictate the owners position i would be in the clear, however it does not work. I am wrting becasue my console is saying that setPosition() has the wrong number of parameters. I dont get it. It also says, getCurrentCameraPosition is an unknown command.


:{

function hudDisplayCameraLock::onUpdate(%this)
{
	$cameraPositionX = getWord(%this.owner.getCurrentCameraPosition(), 0);
	$cameraPositionY = getWord(%this.owner.getCurrentCameraPosition(), 1);


	echo( "hudDisplayCameraLock::onUpdate." ); 
	echo( "  cameraPosition? " @ $cameraPosition );
	
	%this.owner.setPosition($cameraPositionX, $cameraPositionY);
}

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.