Ninomocos Posted April 7, 2015 Share Posted April 7, 2015 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 More sharing options...
rsadwick Posted April 7, 2015 Share Posted April 7, 2015 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 More sharing options...
Ninomocos Posted April 7, 2015 Author Share Posted April 7, 2015 Thanks for your answer. But the problem is that my player moves in y coordinate when the ball hits him (keyboard only affects to x velocity of the body) ... I think it's due to Newton's third law ... Am I right? Link to comment Share on other sites More sharing options...
Ninomocos Posted April 8, 2015 Author Share Posted April 8, 2015 Ok. I have found the solution limiting "manually" the body's x coordinate to avoid my player get inside the immovable obstacles. Thank you. I don't know if this is the perfect solution but it works for now. Link to comment Share on other sites More sharing options...
ZoomBox Posted April 8, 2015 Share Posted April 8, 2015 Hello, you're right.2 immovable bodies will never check for colision between themselves. Reading the doc, I can't find any solution. Link to comment Share on other sites More sharing options...
Recommended Posts