It seems that phaser’s body.blocked variable doesn’t work consistently when my game is running at around 30 fps or lower. When I run against a wall, my player.body.blocked.left or right variable either doesn’t get set to true, or changes rapidly from true to false. It doesn’t affect me when playing on my desktop, but my slower laptop has major problems. I made an example game to show this:
60 fps:
blocked works as intended
~30 fps:
blocked flashes on and off
~20 fps:
blocked only turns true for one frame every few times I hit the wall
Edit: I can’t figure out how to paste the code without it taking up the whole post so here’s the game’s files.
In a lot of cases I think flipping back and forth is normal because it’s the result of separation after the collision. I’m not sure about the low-FPS case.
If the fps of the physical simulation are much higher than the fps of the render, then between rendered frames more things happen than we can see on the screen.
But I guess a callback in the collision should work.
I was experiencing a similar issue with a static group of colliders. When my battery was low / device was overloaded these would all be ignored, setting: