jawm Posted August 28, 2014 Share Posted August 28, 2014 i'm trying to make crates which can be moved by the player. the game is a platformer. I'm having the issue that when the player pushes the crate against a wall, they can no longer move it away from the corner. i want to make it so that when the player jumps on top of the crate it gets pushed to the side, thus getting it out of the corner. i'm not sure how to detect if the collision between the player and the crate is on the top. im using the arcade physics engine. is there any simple way of achieving this? Link to comment Share on other sites More sharing options...
lewster32 Posted August 28, 2014 Share Posted August 28, 2014 In the collision callback you can get the body.touching object to tell you the direction of the collisions:game.physics.arcade.collide(player, crates, function(player, crate) { if (player.body.touching.down && crate.body.touching.up) { // the player is colliding with this crate from above, so do something with this crate }}); michaelcalkins 1 Link to comment Share on other sites More sharing options...
Recommended Posts