(Solved) Changing Animation from walking to running using player's Speed

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

.

What is the expected result

Explain what should happen when you run the game.

What is the actual result

Explain what is happening instead, what is going wrong.

Related screenshots

Please include a screenshot of the full related events including both conditions and actions.
And screenshots to help showing us the issue.

Project files (optional)

Insert a minimal game showing your issue in a .zip or .rar.

Hello, I am in serious confusion how to do this thing… Like i did a success changing the animation from walk to run using player’s speed. But something off…Walking To Running

Click on Walking To Running to see video.
As you can see in the video the player’s running animation doesn’t play at all. It only plays when i release the key(all though i didn’t set it in the events)… This is the problem.

This is the event


Can anybody Help me with this?

Hi,

I think the main problem with your events is that in the second block within the red frame you take the ‘maximum horizontal speed’ but instead you need to use ‘the current horizontal speed’

Additionally:

The first block in the red frame is a bit strange. You could set the maximum horizontal speed of your player at the beginning of the scene and your player won’t be faster than that value (The default maximum speed of the platformer object is 250 and it cannot be changed in the behavior menu).

You have an inverted “player is moving” event in which the maximum horizontal speed is set to 250. So if your player is not moving why is it necessary to change the maximum horizontal speed?

You also have to add an event that sets the animation back to walking when the current horizontal speed is less than 350 (otherwise the player will keep the run animation).

Everything is working except the animation

the main problem is actually the running animation is not playing.It’s just stuck at the first frame…

Probably you need a trigger once condition.

Nah, finally fixed it. All i had to do was like, when the left or right key is pressed
And while the player’s maximum speed is this then change the animation and it worked!

1 Like