I’ve got problem with collision detection for my sprites. The thing is that collisions somewhat are working but not as expected. When player (red object) is colliding with blue object from his left side, red object collides properly with the blue one. But when red object is colliding with the blue right side, red object jumps to the left side of the blue one suddenly.
Weird thing is also with box collision. It looks like only top-left corner of the box is properly colliding with player. Otherwise player just fly trough under the crate instead of stopping before the crate.
Here is the gif showing described situations > GIF
Demo is hosted on heroku > Demo
And full source code on gitlab > source code
I’m expecting that player (red one) is stopped by crate when colliding with it. Now it’s stopping only in collision with top-left corner of the crate which is wrong.
And about blue ball - it looks like collisions are not working properly either. When red approaches blue from the right side of the blue one when collides the red one jumps over the blue. Red ball should be stopped by blue.
It looks like setVelocity helps here a lot! Thanks.
Now the problem is with red ball jumping over blue one when collision occurs from the right side of the blue ball. And with the crate collision also when approaching from the right side of it.
As you can see, pushing the blue ball by red one is somehow broken. Pushing blue one to the right side in straight line is ok. But pushing down, up or left is not working correctly. Red ball slides around blue one or jumps over it from right to left.
I found the “solution”. Downgrading phaser from 3.19.0 to 3.16.2 fixes the collision problem. It means that something changed in 3.17.0 because the 3.16.2 is the last version where collision behaves correctly.