Jump to content

make velocity not changed after collide


gondai
 Share

Recommended Posts

i have create mini game with collision system on it. the game about the ball bouncing on moveable player's box. all code is working well. the problem is while i move the box and hit the ball it become faster. i want the speed stay as it what ever happen to the ball.
 
here is my code:

game.physics.arcade.enable(box);game.physics.arcade.enable(ball); box.body.immovable = true; box.anchor.setTo(0.5, 0.5); ball.anchor.setTo(0.5, 0.5); ball.body.collideWorldBounds = true; ball.body.bounce.setTo(1, 1);ball.body.velocity.setTo(150, -150);	

this http://phaser.io/examples/v2/arcade-physics/bounce-knock as reference, try to push the ball using the alien, it is what i mean by the speed is changing.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...