Hi! I’m making a platforming game using Phaser 3, and i want to have ‘bouncing platforms’. What i mean by this is having the player bounce off of the platforms when they hit them. So far I’ve tried to use the setBounce(0, 1) method on collision, but it just makes the player bounce off of everything. I have tried to invert the player velocity on collision as well, but the velocity on impact is 0, so it doesnt work, and i’m a bit lost now.
So overall the main idea would be to have a setBounce(0, 1), but only on my platforms and not the player. But i dont really see how to do that, so thats why i’m asking for help here
Have a nice day!
Instead of add.collider(…)
you can do
function update () {
player.setBounce(0, 1);
this.physics.collide(player, platforms);
player.setBounce(0, 0);
// …
}