Jump to content

Animation on multiple rows spritesheets


Andy R
 Share

Recommended Posts

Hi,

i'm facing a issue animating a char with spritesheet. I'm trying to animate a character with up/left/down/right animation.

I'm using this one : https://opengameart.org/content/cowboy-platform-and-isometric-sprite-sheet
Here's my code : https://pastebin.com/2EF6CEk5

Left and right moves work well, the error appears when using "up" moves, the character does not start animating with the good frame (i want it to start with first column 6 rows), instead it starts with 7 cols 6 rows ). Maybe i dont understand how case numbers work xith multiples rows spritesheets.

By the way, i'm very new to Phaser, i'm up to hear advices if there's a better way to do this.

 

image.png.05ef006eda55a91a89a49884e5df5637.png

Here's the first frame of up move.

Thanks

Link to comment
Share on other sites

The issue is that you said that sprite sheet frames are 129 x 129 pixels, but the sprite sheet itself does not fit evenly into these dimensions. It has a width of 1792 which / 129 = 13.8914, so when Phaser tries to chop the frames up based on the image width it can't do it evenly, so the frame IDs are all out of sync.

I'd recommend fixing the sprite sheet so it evenly divides by 129.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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