Animating Sprites
by USC - IMD student 4 · in Torque Game Builder · 09/29/2006 (5:33 pm) · 2 replies
Hello,
I'm trying to make a fighting game. Currently I have an animation that runs when the player is idle, but when they press a button, the character will do a punch animation.
I'm able to get the animation to change to the punch animation but i'm not sure how to get it to switch back to the idle animation after the punch is complete.
I tried:
playAnimation(%animation, [%autoRestore = false], [%startFrame = -1], [%mergeTime = false])
doing $player.playAnimation(punchAnimation, true, 0, false);
but this still loops the punch animation.
i'm not entirely sure how to use callbacks otherwise I'd use onAnimationEnd().
Also another question is kind of general set up.
my idle animation is smaller than my punch animation. Should I just make all my animations lined up and filled to a larger size, even if the picture doesn't require it, or should i just resize and reposition the player depending on the animation?
Thanks
I'm trying to make a fighting game. Currently I have an animation that runs when the player is idle, but when they press a button, the character will do a punch animation.
I'm able to get the animation to change to the punch animation but i'm not sure how to get it to switch back to the idle animation after the punch is complete.
I tried:
playAnimation(%animation, [%autoRestore = false], [%startFrame = -1], [%mergeTime = false])
doing $player.playAnimation(punchAnimation, true, 0, false);
but this still loops the punch animation.
i'm not entirely sure how to use callbacks otherwise I'd use onAnimationEnd().
Also another question is kind of general set up.
my idle animation is smaller than my punch animation. Should I just make all my animations lined up and filled to a larger size, even if the picture doesn't require it, or should i just resize and reposition the player depending on the animation?
Thanks
About the author
#2
although, that seems kind of innefficient with the resources, is there no other way in doing this?
playAnimation doesn't work?
10/02/2006 (5:38 pm)
Thanks for the help don.although, that seems kind of innefficient with the resources, is there no other way in doing this?
playAnimation doesn't work?
Torque Owner Don Schaper
XIX Software
function checkIfAnAnimationIsDone( %anAnimation )
{
if ( %anAnimation.getIsAnimationFinished() ) { ...do stuff, like triggering another animation... }
else schedule( 25, 0, "checkIfAnAnimationIsDone", %anAnimation );
}