Mefteg Posted February 27, 2014 Share Posted February 27, 2014 Hello, I have a problem with sprites with a body set as immovable.When my player collide with two immovable bodies, one of these bodies moves. You can try with the two bushes under the player.1- Go on top of the left bush and collide with it2- While still colliding, try pushing the right bush http://folia-game.herokuapp.com/index-dev.html The code for the player and the bush are easely readable with DevTools (player.js and bush.js, you can read obstaclesgroup.js too). I don't understand what I'm doing wrong so if someone can help me to fix it, I'll owe him one. Thank you. Link to comment Share on other sites More sharing options...
EyeKyu Posted February 27, 2014 Share Posted February 27, 2014 I had a similar issue, I had the player, obstacles and enemies the player and enemies had to have immovable=false and obstacles had to be immovable=true otherwise the obstacles would just be pushed around, but this caused a problem with the enemies and the player, they wouldn't collide so What I done was checked the distance between the player and all the enemies if the distance between them = (enemy.width+player.width)/2 then the enemy stops moving or whatever I wanted to happen. I had a quick look trough your code but I couldn't find where you set the immovable property on the obstacles or player Game looks pretty cool BTW Link to comment Share on other sites More sharing options...
Mefteg Posted February 27, 2014 Author Share Posted February 27, 2014 Thank you I can, like you did, hack it but I would know if a clean way exists. Link to comment Share on other sites More sharing options...
Mefteg Posted February 28, 2014 Author Share Posted February 28, 2014 Up Link to comment Share on other sites More sharing options...
Recommended Posts