Hey guys! So I have a player and when he does not have a power up, he is one size, and when he has a power up he is larger. Also just the way the sprite is when the player is walking left or right slightly shifts, so when my player is facing the right the hit box is slightly different from when the player is facing the left.
In my update method this is what I do to handle the minor shift in hitbox:
if (!hasPowerup && playerisfacing == 1)
{
setHitbox(40, 60, -3, -20);
}
if (!hasPowerup && playerisfacing == 2)
{
setHitbox(40, 60, -16, -20);
}
The problem I have is, say I jump towards a wall, in this game the walls do not allow the player to pass through them, but if I jump towards a wall, and change my player direction the hitbox changes like it should, but if I am touching the wall while the hit box is changing, my player clips into the wall and gets stuck… I am assuming it has to do with me changing the values of the hitbox?
What do you guys think? Is there a simpler way to do this?
Thank you!