How can I make the main character duck?

Hi how can I make the main character duck while the down button is pressed?? BTW if there is a thread to this question send it

Add an animation to your character sprite where they are ducking. Then add an event where when the down button is pressed the sprite changes to that animation.

So I did it but it won’t work.


Add a Trigger once while true to the down key check condition. Otherwise you’re setting the animation to 3 every single frame that the key is held down.

This is how I have mine set up. Works for me. Hopefully it can help. My “squatting” animation is only one frame, though.

You’ll have the same problem as Ery if you have more than one frame in your squat animation.

How many frames are there in your other animations?

I’m not having a problem lol. Mine works, so I was posting my code to try and help him out.

Yes, I know you’re not having a problem. That wasn’t what I was getting at.

You only have one animation frame, so your change to the squatting animation is not bringing the same error that Ery has. If you add an frame to your squatting animation, you will have the same issue Ery has. As per my previous post.

Ery needs to use the Trigger Once condition when checking for down key press, because otherwise the condition is true while the key is pressed, and the animation is reset. Every time the screen is refresehed/updated. Which is about 60 times per second.

Thanks it worked!! The only thing I needed to change was that the animation I just change it to one frame.

You missed @MrMen’s point:
Just add the “Trigger Once” advanced condition to the “Down key is pressed” condition when you set the animation. Otherwise the animation will restart each time “Down key is pressed” is evaluated… which is every frame.

Like this? Because it doesn’t work. BTW I’m new :grin:

No. Not there. Click on the “Add condition” immediately below the “Down key is pressed” condition and add it there, so the two are in the same box:

Ok so I did it but how can I make the character move with a different animation, to either side if the down and left or right button is pressed.

When you check if the left or right keys are pressed, have a subevent that checks whether the down key is pressed.