Swapping animations
by baylor wetzel · in Torque Game Builder · 07/03/2006 (12:46 pm) · 3 replies
Sorry for so many posts, i'm still evaluating and trying to see how easy it is to do the kind of game i'm interested in
How does one swap an agent's animation?
For example, in an RPG, the player would have a N, S, E and W animation (and possibly NW, etc.), an idle animation, a cast-magic animation and a swing-sword animation. i'm assuming it's something easy like $player.animation = "~/data/images/idle.anm" or somesuch
How does one swap an agent's animation?
For example, in an RPG, the player would have a N, S, E and W animation (and possibly NW, etc.), an idle animation, a cast-magic animation and a swing-sword animation. i'm assuming it's something easy like $player.animation = "~/data/images/idle.anm" or somesuch
About the author
#2
But it's a big doc. Could you give me a hint where to look? Would the class be t2dAnimatedSprite? Ah, OK, i see, it has a method named setAnimation (pg 70). Takes as a parameter something called a t2dAnimationDatablock. Hmm, the hyperlinks don't work in the PDF. Guess i better start digging into the docs - there's a lot here to read (ah, pg 185)
So, um, i would put down a t2dAnimatedSprite, set it's class to Player (or whatever), in game.cs or wherever i start the game i'd create a global variable named $player and in Player.cs on some event i'd do something like $player.setAnimation( attackAnimation ); (there are other parameters but i'm guessing they're optional)
Guess i better start playing with it and see what kind of damage i can do
07/03/2006 (7:05 pm)
Andrew, the trial version of TGB comes with the 378 page SDK documentation listing all the classes and their properties. So if it's one of those, it's already released to the general public and i'm assuming we can talk about it (although from the EULA it looks like we can discuss anything not directly related to the engine source code, per a different thread here)But it's a big doc. Could you give me a hint where to look? Would the class be t2dAnimatedSprite? Ah, OK, i see, it has a method named setAnimation (pg 70). Takes as a parameter something called a t2dAnimationDatablock. Hmm, the hyperlinks don't work in the PDF. Guess i better start digging into the docs - there's a lot here to read (ah, pg 185)
So, um, i would put down a t2dAnimatedSprite, set it's class to Player (or whatever), in game.cs or wherever i start the game i'd create a global variable named $player and in Player.cs on some event i'd do something like $player.setAnimation( attackAnimation ); (there are other parameters but i'm guessing they're optional)
Guess i better start playing with it and see what kind of damage i can do
#3
07/05/2006 (8:52 am)
The animation you create in the "Animation Builder" is an "Animation Datablock". Call .playAnimation() on the animated sprite passing it the animation datablock name (same one you gave it in the animation builder).
Torque Owner Andrew Douglas
I hope that helps.
Edit: stupid keyboard!
-Andrew