Jump to content

Setting player's body immovable property to true in a breakout game?


Ninomocos
 Share

Recommended Posts

First of all excuse me for my limited english. Corrections are welcome.

I am making a simple breakout style game only for learn and fun. I have set the player's body.immovable property to true to avoid the player moving when the ball hits him (as seen in some basic tutorials ) but this cause my player ignore collisions with another immovable bodies and I don't want this. Is there any alternative? I think player shouldn't have the immovable property set to  true, but I can't find other way in the documentation.   I am using arcade physics.

Link to comment
Share on other sites

If you want to restrict your player movement - consider restricting their controls.  For example on the keyboard.

game.input.keyboard.disabled = true;

You can do the same for mouse and touch.  Take a look at Input: http://phaser.io/docs/2.2.2/Phaser.Input.html

 

An immovable Body will not receive any impacts from other bodies.  This can be useful if a player has a powerup or part of the level is not destructible.  I wouldn't use it to stop your player from moving.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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