(Demonophobia:Redux movement test) How do I fix crawling animation stuck in 1 frame?

When I tried to do crouching and crawling, holding down and left/right arrow key, The crawling animation play, but it get stuck at 1 frame.
Down arrow > Crouch
Left/Right Arrow > Crawling
Animation

How do i fix Crawling animation being stuck in 1 frame?
I did this events:

There are a few ways to fix it, with my preference being the first one:

  1. You could use a finite state machine to determine what state the player is in (in this case crouching or crawling). If in crouch mode and the left of right arrow keys are pressed, then change the state to crawling. And likewise, if the state is crawling and neither left nor right arrow keys are pressed, then change state to crouch.

  2. You could use a variable to store the name of the animation to play setting it to the animation name that you currently have in all the change animation actions. Then in an event at the very end of the event sheet do you set the animation using this variable. This event will be the only one to set the animation by name; all the other events only set the variable to the animation name.

Can you show me a example of events?

I don’t even try both. As I did some events according to AI:




How do i add “If key is pressed” action and “Key is not pressed” condition?

You don’t. It’ll be a subevents off the event:

image


Invert the condition:

image

Don’t use if all of these conditions are true
If you are not using it inside if one of these condition is true
By default your conditions need to be true

I will just give you example so you can understand
Imagine you have 3 animations

Idle plays when player is not moving and is on floor

Walk plays when player is on the floor and is moving left or right

Attack plays when player is on the floor and attack button is pressed

Now everything cool and all
Idle and walk animation can’t conflict with each other
But what about attack animation?

When player is on the floor and not moving then idle animation should play
But when you press attack button then player is still on the floor and is not moving
So now both attack and idle animations have right to play
And they fight for right to be played

Same as when you move and press attack
Both walk and attack animations have right to play

Now you see how you just created conflict?

Imagine all you needed to do to avoid it is to add to both idle and walk animation change events
INVERTED attack button pressed

This way both idle and walk animation will never conflict with attack animation and vice versa

And that is all the knowledge you need to avoid conflicts yourself

I do it this way
Animations gets stuck which tells me 2 or more animations can play at the same time

I start disabling animation change events (default key D or J i don’t remember) to see which animations are allowed to play in scenarios i don’t want them to play

And when i find it
I compare their conditions checking what is allowing for them to play and when

And now all i need to do is add to one something that will prevent it to play in certain scenarios and to other something that does not

In this walk idle attack animation change it was just checking if INVERTED attack key is pressed

Armed with that knowledge you will be perfectly capable to debug your animations yourself

At 1st it is confusing
But trust me you will learn it very fast

I totally forgot.

It appears that crawling animation get stuck in 1 frame while playing.

Is there a way to fix it?

It’ll be two competing animation changes. The conditions for crawling will also meet the conditions for another animation.

One way to figure out which one, put some log to console actions after each set animation action with the animation name as the text. When you run the game, check the console output to see what animation is also being set.