Jump to content

Multiple animation sequences? (SOLVED)


Ninjadoodle
 Share

Recommended Posts

Hi guys

 

Normally I would setup my movie clip like this ...

 

Mouse = game.Class.extend({
    init: function(x, y) {
        this.sprite = new game.MovieClip([
            game.Texture.fromImage('mouse1.png'),
            game.Texture.fromImage('mouse2.png'),
            game.Texture.fromImage('mouse3.png')
        ]);
 
        this.sprite.anchor.set(0.5, 0.5);
        this.sprite.position.x = x;
        this.sprite.position.y = y;
 
        layerMg.addChild(this.sprite);
    }
})
 
Is there any way to add more animation sequences? For example, jump, walk?
 
Thank you in advance!
Link to comment
Share on other sites

You can do it like this:

this.runAnim = [    game.Texture.fromFrame('run01.png'),    game.Texture.fromFrame('run02.png'),    game.Texture.fromFrame('run03.png')];this.jumpAnim = [    game.Texture.fromFrame('jump01.png'),    game.Texture.fromFrame('jump02.png'),    game.Texture.fromFrame('jump03.png')];this.sprite = new game.Animation(this.runAnim);// Change animthis.sprite.textures = this.jumpAnim;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...