t2dAnimatedSprite methods
by Glenn Thomas · in Torque Game Builder · 04/30/2009 (3:19 pm) · 5 replies
I'm familiar with the playAnimation method for a t2dAnimatedSprite but is there a method to stop a t2dAnimatedSprite? I've read the documentation that covers the methods for a t2dAnimatedSprite and don't see it. Does anyone know how to stop an animated sprite? My animations are overlapping because the previous animation must finish as the current animation begins.
About the author
#2
I need to stop looped animation on click... :(
Thank you!
07/17/2009 (3:46 am)
How did you stop animation? Can you help me please? What command did you use?I need to stop looped animation on click... :(
Thank you!
#3
I eventually migrated to a giant case statement and that eventually got condensed into a much easier to update finite state machine. It was a long process trying to get this to work with torque script. You gotta get in there and dig into that scripting read all the documentation until it clicks. I've seen many ways to do this all over the forums so do your research and it'll click. Try not to take shortcuts though cause it'll only waste your time. Just tackle each task one at a time and overcome the obstacles in front of you. This should be fine for now.
11/06/2009 (3:32 pm)
Man I haven't been here in awhile due to my ever turbulent personal life... ummm I hoped you figured this out by now but I did something similar to what's on the TDN. I don't have the source on the laptop but here's the code snippit...function playerClass::setCurrentAnimation(%this)
{
%xVelocity = %this.getLinearVelocityX();
%yVelocity = %this.getLinearVelocityY();
if(%xVelocity > 0)
{
%this.setFlip(false, false);
}
else if(%xVelocity < 0)
{
%this.setFlip(true, false);
}
if(%this.airborne)
{
if(%yVelocity < 0)
{
%this.playAnimation(playerJumpUp);
}
else
{
%this.playAnimation(playerJumpDown);
}
}
else
{
if(%xVelocity == 0)
{
%this.playAnimation(playerStand);
}
else
{
if(%this.getAnimationName() $= "playerRun")
{
if(%this.getIsAnimationFinished())
{
%this.playAnimation(playerRun);
}
}
else
{
%this.playAnimation(playerRun);
}
}
}
}I eventually migrated to a giant case statement and that eventually got condensed into a much easier to update finite state machine. It was a long process trying to get this to work with torque script. You gotta get in there and dig into that scripting read all the documentation until it clicks. I've seen many ways to do this all over the forums so do your research and it'll click. Try not to take shortcuts though cause it'll only waste your time. Just tackle each task one at a time and overcome the obstacles in front of you. This should be fine for now.
#4
11/18/2009 (3:14 pm)
I forgot to add to make the animation stop on click just have it play a single frame animation.
#5
www.garagegames.com/community/forums/viewthread/105651
11/18/2009 (4:03 pm)
This may be useful to you:www.garagegames.com/community/forums/viewthread/105651
Torque Owner Glenn Thomas