naveen Posted July 25, 2014 Share Posted July 25, 2014 I want two arcade physics bodies to single sprite, one is for horizontal collision and one is for vertical. can we do this? Advance thank you. Link to comment Share on other sites More sharing options...
lewster32 Posted July 25, 2014 Share Posted July 25, 2014 No, but you can detect which direction the collision is coming from by using touching:game.physics.arcade.collide(player, obstacles, function(player, obstacle) { if (player.body.touching.left || player.body.touching.right) { // do something for a horizontal collision } else if (player.body.touching.up || player.body.touching.down) { // else do something for a vertical collision }}); Link to comment Share on other sites More sharing options...
Recommended Posts