Jump to content

Multiple spritesheets


Faizy
 Share

Recommended Posts

Hey,

 

I have a spritesheet which has different sizes for each sprite(like this one for example, as you can see they are differences in the size of each frame ). Let´s assume I have a spritesheet called "running" and one called "jumping", the first one is 50x50 and the second one is 50x70.

Since they have different sizes, I added them separately into the game. Both animations work fine. The problem I have now is, that I see every spritesheet all the time, since I have to add them into the game, meaning all the animations/different spritesheets are overlapping.

 

1. Is there a better way to solve the Problem of different sized spritesheets?

2. What would be a good solution to my problem?

 

Thank you and have a nice weekend :)

Link to comment
Share on other sites

Just hide the sprite that's not in use and show the one that is:  jumping.visible = false; running.visible = true;  And if the different animations have different widths, use the anchor property to align them, eg to align them centrally: jumping.anchor = new Phaser.Point(0.5, 0.5);

Also, it's probably a good idea to add each sprite to the same Phaser.Group.  That way you can just move and rotate the whole group rather than each individual sprite.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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