…the player position is reset every time it collides with an enemy…
if (collide("enemy", x, y)) {
x = FP.camera.x + 32;
y = FP.halfHeight;
Well, msot of your problems are things you made and that you didn’t see. It took me less than 2 minutes to check this, and that’s why I’m saying it, but no way we can check all your code for free, time is precious