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