Animated sprites
by Charles Scholten · in Torque Game Builder · 08/23/2006 (3:59 am) · 4 replies
Hi,
I've created an animated sprite, and when i start the level, the animation sequence is played. I only want the animation to play when the object is clicked on.
How can I prevent the animation from being played when starting the level?
Thanks in advance
a soon to be TGB owner :D
I've created an animated sprite, and when i start the level, the animation sequence is played. I only want the animation to play when the object is clicked on.
How can I prevent the animation from being played when starting the level?
Thanks in advance
a soon to be TGB owner :D
#2
Thanks for the reply, but the option 'Repeat' is already unchecked. I can already play the animation by clicking the the sprite.
08/24/2006 (2:05 am)
Hi David,Thanks for the reply, but the option 'Repeat' is already unchecked. I can already play the animation by clicking the the sprite.
#3
for instance on the 1234 animation sprite I made it non repeating, and set it to frame 3 (which displays a 4):
function myanimation::onLevelLoaded(%this, %scenegraph)
{
%this.setAnimationFrame(3);
}
08/24/2006 (5:23 am)
Set your animation sprite's frame to the last frame on level load.for instance on the 1234 animation sprite I made it non repeating, and set it to frame 3 (which displays a 4):
function myanimation::onLevelLoaded(%this, %scenegraph)
{
%this.setAnimationFrame(3);
}
#4
08/24/2006 (6:10 am)
Great! That works!! Thanks for the help!
Associate David Higgins
DPHCoders.com
call the setUseMouseEvents() method of the object
in the onMouseClick() callback of the object, call the objects playAnimation() method
Hope this helps -- I'd provide code to support this, but have not actually done it yet -- if necessary, I suppose I could whip something up real quick (need to write it eventually anyhow ;p)