Walk animation to the left [SOLVED (with screen to help)]


#1

Hello !

I know it may be a “newbie” problem but I didn’t find any answer that I could perfectly understand on this forum… I just want that when I touche the “left” button, it makes my character goes to the left. The animation is on loop, at the right speed (exactly the same configuration for the “right animation” which works perfectly!)

I just don’t understand why when I do the same thing with the “left animation” the animation block at the first frame, even when I keep the button pushed long enough. :frowning:

It’s surely nothing, I am really sorry (but it’s for a school project so it’s important, I wish to have the right technique to go further into the work !)


#2

Have you gone through the tutorial? I just set my player up the way they recommend:

You can then give the player an object variable called “direction” and change the value of that variable to either “left” or “right” depending on which key is pressed. When the value is “left” you can add the action of “flip horizontally” and when the value is “right” you can invert the action “flip horizontally”.

Here’s my code straight from my game (the character’s name is “Ozzy”):


#3

Beanmatt’s answer is pretty spot on. I’d recommend making sure you go back through the platformer tutorial on the Wiki.

That said, look at your animation events. you have a “When right key is not pressed, set animation of Help to idle”

However, you also have “When left key is pressed”

Both of these can be true (Right key is not pressed AND left key is pressed" so you have a conflict of your animation events.


#4

Oh my god, you’re so right, I didn’t understand it that way but it makes so much sens !
Thank you sooo much, I can’t test that right now, but when I will, I’ll tell you if it’s work (but now I bet it’ll work perfectly)

Thank you two very much ! :smiley:


#5

It worked, thank you very much !
I just had to delete my “when right key isn’t pressed” and put instead “when character is not moving” and it work perfectly ! :smiling_face_with_three_hearts:


#6

It’s been a while, I promised I would make a screen to explain to the next how it must work. Maybe it can be simplified but at least it worked for me.

Adventurer, if you reshearch a good way to walk (and have sound with it) here is your precious !