Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Problem with Sprite


SteveMavic
 Share

Recommended Posts

There are two problems you have to solve with spritesheet:

  • load all frames - you have 12 frames. Load your spritesheet like: game.load.spritesheet(key, url, width_of_frame, height_of_frame, number_of_frames_total) ... number_of_frames_total  = 12 in your case. Refer to this example: http://phaser.io/examples/v2/animation/sprite-sheet (mummy frames are not all in one row),
  • create your animations - "walk", "jump" in your case, like this: this.animations.add("walk", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); and this.animations.add("jump", [11, 12]); ... simply refer to frame indices.

Then you can play anims like: sprite.animation.play(anim_name) ... anim_name = "walk" / ""jump"

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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