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

Keeping sprites still


dcbriccetti
 Share

Recommended Posts

Hi all. I just started using Phaser, and I’m excited by the potential. I could use some help with some problems in this game:

 

http://davebsoft.com/web-games/invisible-maze/

 

https://github.com/dcbriccetti/web-games/commit/d814fe45a655e8fc0916149156fca95cb22c7a3c#diff-ad4eb6229e24f5cc681cc10695f640ca

 

When the player character hits the “mines” (lightning bolts), he rotates. I don’t want him to. Sometimes the mines move about “aimlessly”. I don’t want them to move (except perhaps a little when the player character bumps them).

 

I’ve looked at several examples and read some of the source code, but I feel like I’m still sort of guessing about a lot of things. Perhaps someone could give the code a quick general review?

 

Thanks!

 

Link to comment
Share on other sites

To stop the player rotating you need to fix its body: http://docs.phaser.io/Phaser.Physics.P2.Body.html#fixedRotation

Sprite.body.fixedRotation = true;

To stop the mines moving you probably want to do the same and then maybe make them static? Although that would completely stop them moving. Perhaps they just need a little more mass to make them heavier?

Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

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