- Home /
How do I use the PlayAnim function in SpriteManager 2?
I am using Sprite manager 2 and I have managed to make it the sprites playing the default animation. Now, I wanna make my character play the Jump animation or walk animation by calling the PlayAnim function from a Java script attached to the character. Sorry, I am new to this & I am c# illiterate :(
Answer by yjsoon · Apr 24, 2011 at 01:34 AM
SM2 comes with a set of documentation to help you get started take a look in the SM2 Docs folder, and open up index.html.
Here's some example code from the documentation, which assumes you've set up a PackedSprite object called sprite:
// Play "walk" animation: sprite.PlayAnim("walk");
// Play "walk" animation if it isn't playing already: sprite.DoAnim("walk");
// Play the animation at index 3: sprite.PlayAnim(3);
// Play the animation referenced in the variable walkAnim: sprite.DoAnim(walkAnim);