When i press the melee button it only play the first frame!

Hello i am new to the Gdevelop and i have a little bit of problem with my melee attack animation can you guys help me

the problem:when i press melee button it only play the first frame and then it stopped
(upload://QwKWGQm9GR2QOFOw3JjIiELrrU.png)

Gees… is hard to tell, why don’t you use the animations names to identify your animations instead of animation0,1,2 you can use properly animation = “Attack” anyway i think the problem is because you are setting an animation when is not moving so that is triggered even if you press the melee button.
Possible solutions
Add a variable to charactermain like isAttacking so later check
if not moving charactermain and charactermain.isAttacking == false
Do idle

And when you press Attack button or meele button
Set charactermain.isAttacking = true
Then
Add another event and check
if animation of charactermain == ‘Attack’ or the number i think in your case is 3
on animation finish
Set charactermain.isAttacking=false

1 Like

Just a shot in the dark, but your animation is on looping, right?

yes it’s on looping


tis is the animation

Ok so question 1 does the attack animation play the whole thing if you hold the control button down? That’s a good test. Also is charactermain standing still while attacking? Maybe that’s conflicting with the inverted player is moving/set to 0. Question 2 is what is the group of events at the bottom for? Do you even have an animation named “idle” why not use 0 there like the rest or just say animation finished and player not moving. And is it a standalone event or is it supposed to be a subcondition of the attack animation? Anyway I’m befuddle by this whole ordeal.

As UlisesFreitas said, it’s because the other events are change the animation. If rcontrol is your melee key then on that pass through of the events it changes your animation but then on the next pass if a direction key is pressed or the players isn’t moving then the animation is changed again.

You need some type of check before changing it similar to your “animation is/animation finished” or as UlisesFreitas recommended, you can use a Boolean variable to track the various states.

Each event wouldn’t need a check if you add a check and then make the other events subevents of it.

Try taking your charactermain animation finished/is idle" part and making it a subevent of the RControl key, so it only is triggered once your animeation3 is complete. I also don’t think you need the “is idle” part because you already have that stated in the charactermain is not moving, so it just repeats that what you have already told it to do…

Hey can you send me the image of the things you said i don’t kinda understand that