Game Development Community

playing animation X on event y

by rennie moffat · in Torque Game Builder · 09/15/2009 (2:38 pm) · 1 replies

Hi,
I had some code which worked perfectly for simply changing frames.
function xxx::onAdd(%this)
{
	$xxx = %this;
	%this.setUseMouseEvents(true);
	%this.setFrame( 0 );
}

function xxx::onMouseUp(%this, %modifier, %worldPosition, %mouseClicks)
{
	if(%this.Animation == 0)  
       %this.setFrame( 1 );  
   else if(%this.Frame == 1)  
       %this.setFrame( 0 );  
}

what I want to do tho is have the event (mouseUp) trigger an animation instead. SO I thought but simply plugging in the correct data, it would run, not so. Could anyone explain why this code is proving to be illogical (doesn't work).


function xxx::onAdd(%this)
{
	$xxx = %this;
	%this.setUseMouseEvents(true);
	%this.setAnimation(xxxOne);
}

function xxx::onMouseUp(%this, %modifier, %worldPosition, %mouseClicks)
{
	if(%this.Animation = xxxOne)  
       %this.setAnimation( xxxTwo );  
 
}

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
09/15/2009 (3:51 pm)
I just remembered a little thing called setCurrentAnimation.

bark twice for yes.


;]