Liam Earles
Member
So I'm making a game where a crouch mechanic takes place. When I release the down arrow key, it would go back to the idle sprite. So because of that, when I crouch or slide under a wall, it would clip through a wall because when I release the down arrow key, it would always go back to the idle sprite where it's not crouching.
Here's a code for when down is pressed:
Here's a piece of code where I release the down arrow key:
Here's a picture of what it looks like when I test my game out.
Here's a code for when down is pressed:
Code:
if sprite_exists(sprite_CowboyWalkingRight)
if sprite_exists(sprite_CowboyIdleRight)
{
sprite_index = (sprite_CowboyDuckingRight)
}
else
if sprite_exists(sprite_CowboyWalkingLeft)
if sprite_exists(sprite_CowboyIdleLeft)
{
sprite_index = (sprite_CowboyDuckingLeft)
}
Code:
if sprite_exists(sprite_CowboyDuckingRight)
{
sprite_index = (sprite_CowboyIdleRight)
}
else
if sprite_exists(sprite_CowboyDuckingLeft)
{
sprite_index = (sprite_CowboyIdleLeft)
}