Animated Sprites
by Matthew Langley · in Torque Game Builder · 02/28/2005 (6:47 am) · 13 replies
Ok, have been messing with animated sprites... I love how robust they are so far... only thing I've run into (and seemingly hit a wall in documentation on as well) is the following:
ok... I want to create an anim with say these frames
"1 2 3"...
I've got this working, and I don't want it to cycle, so I turn cycling off... this works... except it goes like this
1 2 3... then back to 1
what if I want to make it stop at 3 ?
for ex: a charge up animation... then when I release the button it does the firing animation...
Right now I have a workaround with ::onAnimationEnd... i have it then kick back to "3"... though it looks the slightest bit glitchy since now I go
"1 2 3 1 3"
It works for now, just wondering if I'm missing an easier way to do this ?
ok... I want to create an anim with say these frames
"1 2 3"...
I've got this working, and I don't want it to cycle, so I turn cycling off... this works... except it goes like this
1 2 3... then back to 1
what if I want to make it stop at 3 ?
for ex: a charge up animation... then when I release the button it does the firing animation...
Right now I have a workaround with ::onAnimationEnd... i have it then kick back to "3"... though it looks the slightest bit glitchy since now I go
"1 2 3 1 3"
It works for now, just wondering if I'm missing an easier way to do this ?
About the author
Was a GG Associate and then joined GG in 2005. Lead tool dev for T2D and T3D. In 2011 joined mobile company ngmoco/DeNA and spent about 4 years working game and server tech. 2014 joined startup Merigo Games developing server technology.
#2
I'm at work at the moment (have my laptop I do T2D on pulled out and am looking back and forth between the two lol... so if I spell something wrong thats why
now its a simple 2d sprite... when this animation is called he pulls pack (supposed to be a charge anim) set to a down press of the key... the up of the key has his hands shoot out (with a projectile)... now when I call this anim he goes through frame 8 9 10 correctly, but it stops at 8 again
02/28/2005 (9:30 am)
datablock fxAnimationDatablock2D(circleGuyCastSpellLeft)
{
imageMap = circleGuy;
animationFrames = "8 9 10";
animationTime = 0.75;
animationCycle = 0;
randomStart = 0;
}I'm at work at the moment (have my laptop I do T2D on pulled out and am looking back and forth between the two lol... so if I spell something wrong thats why
now its a simple 2d sprite... when this animation is called he pulls pack (supposed to be a charge anim) set to a down press of the key... the up of the key has his hands shoot out (with a projectile)... now when I call this anim he goes through frame 8 9 10 correctly, but it stops at 8 again
#3
did you add an additonal parameter to the set animation function
playAnimation(animation, autorestore); ? by default it is false did you add it to the function call, if so it might be restoring after the cycle.
02/28/2005 (9:38 am)
Interesting indeeddid you add an additonal parameter to the set animation function
playAnimation(animation, autorestore); ? by default it is false did you add it to the function call, if so it might be restoring after the cycle.
#4
so for you the animation will stop at the last frame ? so for ex. if you had an animation that caused a player to lift a shield and stop at the end it would do play the anim and stop with the s heild raised ?
02/28/2005 (9:47 am)
No, but I tried that, that seems to restore it to the previous animation (unless I'm mistaken, I was working on this late night lol)so for you the animation will stop at the last frame ? so for ex. if you had an animation that caused a player to lift a shield and stop at the end it would do play the anim and stop with the s heild raised ?
#5
02/28/2005 (10:03 am)
Correct it should play the animation and stop at the last frame.
#6
could you post up some example datablocks of an animated sprite... at first was confused since I don't think the shooter has an example of one ... and the docs are extremely helpful but a little confusing without an example of how to set one up and use one (maybe I set mine up wrong along the line)
02/28/2005 (10:06 am)
Hmm, I'm going to have to fire this up after work and before classes lol... thx for the responsecould you post up some example datablocks of an animated sprite... at first was confused since I don't think the shooter has an example of one ... and the docs are extremely helpful but a little confusing without an example of how to set one up and use one (maybe I set mine up wrong along the line)
#7
02/28/2005 (10:08 am)
I'l be happy to post after work but that won't be until after 10 pm Eastern. Unfortunetly work computers can't run T2d =(
#8
ouch, can't run T2D ?... I've tried T3D on mine here and it barely runs... I'm sure it would run T2D
02/28/2005 (10:14 am)
Thanks, much appreciated :) I won't get completely home till after 11:30 pm MST anyways...ouch, can't run T2D ?... I've tried T3D on mine here and it barely runs... I'm sure it would run T2D
#10
03/01/2005 (5:54 am)
After some test I got the same result Matt was talking about
#12
Almost went into the source and make it not go back to the first frame, though it was late and after looking at the source code I realized it would take more than a late night of being comfortable enough to change your source Melv ...
glad you fixed it up :) lol you are too quick !
03/01/2005 (7:08 am)
Thanks... at least I wasn't going crazy lol, didn't get a chance to fire up my example again ... I also ran into the onAnimationEnd bug too, I forgot about it or would've mentioned something about it... when I put a work around in onAnimationEnd (though hacky work around) and put an echo in it I saw my console get spammed with the echo text...Almost went into the source and make it not go back to the first frame, though it was late and after looking at the source code I realized it would take more than a late night of being comfortable enough to change your source Melv ...
glad you fixed it up :) lol you are too quick !
#13
I have fixed this problem. It will be included in the next update.
Thanks for the report.
- Melv.
03/04/2005 (8:31 am)
FYII have fixed this problem. It will be included in the next update.
Thanks for the report.
- Melv.
Associate Anthony Rosenbaum