Enemy Knockback Clip

When the enemies hit you, you get pushed back depending on where you’re facing. But when you get pushed against a wall, you clip through the ground, where i’ve set a reset button (Im gonna change it cause it’s too time-consuming).

nice job

Hold on, sorry I think you misinterpreted me. I meant that as a bad thing. You clipping through the ground wasn’t meant to happen. I would just want the enemies to just hit you back, and if you were hit against a wall, you’d get basically cornered.

i meant the game concept

Sorry about that glitch, I love the sprites, very detailed.

sorry, i misunderstood you

thank you

Wow, awesome game! I love the character art and animations, and the title screen looks incredible. And yeah, the clipping is because we don’t check for walls if you explicitly change the x and y of a sprite by a large amount (we will automatically “bump” the sprite away from the wall if you’re only overlapping by 2 or 3 pixels). To avoid this, you could briefly give the sprite an x and y velocity to “push” it back:

This code disables the player controls, pushes the sprite, then after a brief pause, re-enables the controls (otherwise a player holding down the d-pad might override the knockback). You might need to mess around with the numbers a bit, but using the velocity instead of setting the position should allow for correct wall collisions!

2 Likes

thank you so much!