Jump to content

Spritesheet and shape changes


gregorl
 Share

Recommended Posts

Hi all :)

I'm crafting my little space game with ships and other stuff using Phaser - http://gregorl.github.io/spaceships-with-lasers/

I recently created some collision maps for asteroids using PhysicsEditor - it was one polygon per sprite until now.

Now I need to somehow apply the player's ship polygons to the right frame of animated ship.

 

This is my loading code:

https://github.com/gregorl/spaceships-with-lasers/blob/master/src/js/preloader.js .

 

As you can see I use game.load.spritesheet for ship's sprites.

 

And here's the player's creation logic:

 

https://github.com/gregorl/spaceships-with-lasers/blob/master/src/js/game/player.js

 

The sprite is animated, but its body is not. Could someone point me the right direction?

How do I animate sprite's body? How do I apply the shapes to appropriate frames of the spritesheet?

Perhaps I misused PhysicsEditor, when preparing the polygons for each ship's frame?

 

I am asking this, as I was not able to find related topic or Phaser example to follow.

Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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