SOLVED Make Character Duck?

I have a character with the platformer behaviour. The default controls are unchecked and I’m trying to experiment with the controls.

One of the problems I’ve found is that I can’t make the character duck. Even the animation won’t change.

One tutorial told me to add the Trigger Once condition and another didn’t need it to work. I tried both ways and neither worked for me. I can’t find anything on the wiki about a ducking mechanic.

I also tried adding a Key Released condition, but nothing changed, either.

If I could just make the animation change when I press D, that would be enough for me.

EDIT: I copied and pasted the D Key Pressed conditions and actions in a new slot, replacing the Key Pressed with the down button. The animation changes, but the game just glitches out. What’s going on???

You have quite a few animation conflicts happening in your events.

You need to separate your actual logic actions from your animation actions, and you need to ensure two animations cannot occur at the same time (e.g. in your screenshot, e can be pressed, D can be pressed, AND the character could be not moving all at the same time. The engine doesn’t know which to utilize).

This is similar to another recent thread, so I’d recommend reading through the recommendations here: Problem playing the whole animation

1 Like

I looked over the other conversation and did some reorganizing. When I press D, the animation changes, but now the game glitches out until I release the key. This happens when I’m only pressing the D button and when I’m pressing other buttons, too.

The D Key isn’t linked to any other programming in the file.

Here’s a video to show you what’s happening:

Have you check where the points are in the animations. It was happening in my last game try when I added new animations, because the origin point is not in the same spot as the previous ones. (I see your character is flickering to a new position)

1 Like

You still have some conflicts in your new screenshot.

Your “Is not moving > Show Animation 0” event still needs to ensure it doesn’t conflict with the key pressed events.

You could likely solve that just by adding a “D is pressed (inverted)” and “E is pressed (inverted)”.

Separately: make sure your animations are all the same size. Even with the duck, it should still be the same size as the largest frame of any other animation (and that the feet are in the same spot on each one, basically), just make sure you fill the extra space with transparent pixels.

1 Like

I tried both of your suggestions and I got it fixed, but in a strange way.

First, I tried your most recent suggestion, Silver Streak. It didn’t look like it worked at first because the game was still glitching when I tried to make the player duck.

Then I tried Oscuridad’s idea. I had the animation point edited to the sprite’s center because I had a shooting mechanic. I reset it, but there was still glitching. So I moved the point back to the sprite’s center, and THEN the glitching stopped! XD

Technology, right? :laughing:

Or maybe it just goes to show how much work needs to go into making a game. Both your ideas really helped me and I wanna give you both a big thank you for that! The glitch is fixed and I was able to get further in my programming than I planned today!

Here’s the finishing screenshot. For future viewers, this is an external event for a sprite character that’s set as a Global Object.