Game Development Community

onUpdate a good place to set conditions?

by rennie moffat · in Torque Game Builder · 02/22/2010 (6:28 pm) · 2 replies

I am wondering if the onUpdate call is a good place for me to set up things like this...

function starsStar2Behavior::onUpdate(%this)
{
	$starsStar2Pos = %this.owner.getPosition();
	
	if(t2dVectorCompare($starsStar2Pos, %this.laodPos))
	{
		$starsStar2Loaded = true;
	}
	
	if(t2dVectorCompare($starsStar2Pos, %this.waitPos))
	{
		$starsStar2Waiting = true;	
	}
	
	$starsStar2Mounted = %this.owner.getIsMounted();
}

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.


#1
02/22/2010 (6:54 pm)
onUpdate should be used to update a current object already created. To setup an object you should use onAddToScene when the object is created.

Check out this documentation:

tdn.garagegames.com/wiki/TGB/Behaviors/Callbacks
#2
02/22/2010 (7:22 pm)
um, I am not sure what you mean exactly.

These objects are all already created. so... you know. but thanks.



I am thinking this is appropriate tho, anyone?