Good evening FlashPunkians!
I have had this issue before and do not remember if I ever solved it… Basically I have a player, they have a normal hitbox and when they press down the hitbox changes sizes to effectively crouch through lower parts of the level.
The hitbox changes and all is good in that department. The problem is, when the player is crouching in a low ceiling part of the level, if they release the crouch key, the player returns to the normal hitbox state and gets clipped into the wall of the level, never to return… lol unless the player holds crouch again. I know this isn’t how a typical game would handle crouching.
Here is my crouching code:
//crouch to change hitbox
if (Input.check(Key.S) || Input.released(Key.S) && collide("level", x , y))
{
setHitbox(16, 32, -10, -32);
}
else
{
//normal hitbox
setHitbox(16, 48, -10, -16);
}
Thanks guys!