How to change the speed of an object in Phaser without changing its direction

How do you change the speed of an object in a phaser without changing its direction? For example, I have a ball that collides with a moving platform. I want the ball to change direction, but not get extra speed from a collision with the moving side of the platform. So far, I have had to take the sign of the objectโ€™s speeds and then apply a constant speed of value to it in a collision, but this seems to be wrong for the library as reliable as in Phaser.

How do you change speed and direction independently out of speed?

+4
source share
1 answer

bounce, . ball.body.bounce.set(1);.

docs:

. bounce.x/y = 1 , bounce.x/y = 0.5 50% .

+1

All Articles