Working example of fxAnimatedSprite2D question
by Scott Turner · in Torque Game Builder · 06/08/2005 (11:03 pm) · 4 replies
There is a "working example" of a f fxAnimatedSprite2D in the FAQ :
http://www.garagegames.com/uploaded/code/7298.torque2dunofficialfaq.html#1
Could somebody help me decipher this? for example, Is the code in there loading different images (pngs) ? and creating an animation with them? or is it loading actual animation files and displaying them? can somebody help me understand this please? discussing more about it will help me get a better idea. Also if someone has a demo of an animated character with running, walk, jumping, crouch etc poses, I would really appreciatte it if I could download it....thanks !!
http://www.garagegames.com/uploaded/code/7298.torque2dunofficialfaq.html#1
Could somebody help me decipher this? for example, Is the code in there loading different images (pngs) ? and creating an animation with them? or is it loading actual animation files and displaying them? can somebody help me understand this please? discussing more about it will help me get a better idea. Also if someone has a demo of an animated character with running, walk, jumping, crouch etc poses, I would really appreciatte it if I could download it....thanks !!
#2
06/08/2005 (11:30 pm)
Exactly, but, Im confused, the image they show is one png, with all the frames contained in it, right? the code does what? move the image along a smaller frame so that the animation clips show one at a time? this is the part that im confused with.....what is the Cell format IIRC ?? thanks
#3
T2D then does the funky stuff and internally it chops up the image into the individual frames.
When you define the animation you want, you specify the image map, the order the frames will in, and the amount of time it will take to play through all of the frames.
Once again, T2D does stuff internally and divides the time by the number of frames to workout when it should move from one frame to the next.
That's about it really. If your image map contains the graphic of a man walking, you could make him walk the other way, by defining a new animation block with the frames playing in a different order, and calling setFlip on the sprite to make it face the other way.
06/09/2005 (12:13 am)
When the image datablock is defined, it's mode is Cell, and then there are the entries that give the width and height of each cell.T2D then does the funky stuff and internally it chops up the image into the individual frames.
When you define the animation you want, you specify the image map, the order the frames will in, and the amount of time it will take to play through all of the frames.
Once again, T2D does stuff internally and divides the time by the number of frames to workout when it should move from one frame to the next.
That's about it really. If your image map contains the graphic of a man walking, you could make him walk the other way, by defining a new animation block with the frames playing in a different order, and calling setFlip on the sprite to make it face the other way.
#4
06/09/2005 (12:18 am)
Cool, thanks, I just downloaded someone elses walking demo, Im going to dissect his code and play with it, hopefull everything will be much clearer then, Ill ask more questions later...............just in case you want to help me !! thanks again.
Torque Owner John Vanderbeck
VanderGames