change sprite animation in ex2d ?

Hi , how can i change sprite animation in ex2d component ? i want to change animation from walk to jump when touching screen of android device
can any one help me ?

I dont know anything about ex2d but what you want to look for is what texture it is using and change that. Sprites are just sequences of images, change the sequence and you change the animation.

So if you are using sprite sheets and you have a sheet called “Characterwalk.jpg” and you have one called “CharacterJump.jpg” you would create var for each and then replace them at the appropriate time.

var characterWalk : Texture2D;
var characterJump : Texture2;

then call them into your material when you need him to jump.

First you add exSpriteAnimation Component to your gameObject with exSprite, and put your sprite animations into the list of the component.

Then whenever you want to change sprite animation, use this code in your script that has a reference to the sprite.

var sprite: exSprite;

sprite.spanim.Play ("hero_run_01");

The “spanim” is a property of exSprite class, you can always use it to get the sprite animation component. For more details, check out ex2D script reference:



this is my code : `var spAnim:exSpriteAnimation;

function Start()
     spAnim =  GetComponent("exSpriteAnimation");

Hello, I’m having trouble with exactly the same situation, but unfortunately the script above doesn’t work for me.Fist of all, I’m using Unity 4.0.1f2. I added two animations to the Sprite Animation Object, but when I try to call the Start function again in order to play the second animation, the first animation (in the first if part) freezes and it stays like that forever. The code gets in the “else if” part but doesn’t play the second animation. I’d appreciate it v much if you could help me. Thanks

public var spAnim: exSpriteAnimation;

function Start() { 
if (something){


else if(somethingelse){