freetoplay Posted July 7, 2017 Share Posted July 7, 2017 I have a ball that is 26x26 and I am trying to make it change direction when it collides with an object. My code looks something like this: let collideP1 = game.physics.arcade.collide(ball, p1); if (collideP1) { ball.body.velocity.x = -ball.body.velocity.x; } This code gets called in the update() method. However when a ball hits a rectangular object, the movement stops. How do I properly get it to change direction? Please let me know if I need to add more code. Link to comment Share on other sites More sharing options...
Recommended Posts