Attack animation won't display, only shows first frame

I’ve made a character a melee attack animation, but when I press the attack bind button, it only shows the first frame.

Is this command bind not enough to show all frames sequence?

Thanks !

1 Like

When do you switch to the first frame? When you press LControl, you switch the frame to 5 but then immediately switch back to 0 because the condition when you switch to 0 also true and it is override the key press event you have there.

An other possibility is that you have 5 animation frames but the frame begin with 0 so technically the frame numbers are in range 0-4. Because you try to switch to frame 5 which doesn’t exist, it is return 0 and that is why displaying the first frame which is frame 0. Can be confusing but get used to it, in programming and game development when you have an array of something (in this case array of animation frames) the first element usually 0 so if you have 5 frames it is in range 0-4 and not 1-5.

In order to avoid crashes, GDevelop is trying to help and if you enter an invalid value GDevelop return 0 or an empty string “” instead of crashing the game which sometime can cause bugs. So if you experience a bug involve value 0 or empty string “”, always check you are using valid values everywhere.

You are right! These commands caused the problem:

.

Should I replace them with key-binds or is there a way to by-pass the problem using arguments?

Thanks for the help btw!

Add the condition “LControl key is NOT pressed” to each of them next to the is moving and jumping condition, this way when you press LControl, those events should not execute while you are pressing LControl because they are waiting for the control NOT to be pressed.

You can add as many conditions to an event as many you want and you can combine conditions in any ways you want. When you add multiple conditions, ALL of them need to be true to execute the action this is how you can take control of pretty much any situation in GDevelop. There is also sub-events for more advanced use. Sub events are going to be executed only after their parent event was executed. If the parent does not execute neither the sub-event will. It gives you even more power to control anything you want.

It worked, though I need to keep pressing the button to play the full animation sequence, is there way to make it a trigger?

It should play the animation to the end when you switch to the animation, you can also set it to loop forever.
Do you stop player animation somewhere?
If you do, add the condition to check what animation is playing and stop the animation only if the animation is playing that you want to actually stop.

For example if you want to stop animation 1 then add the condition “The number of current animation of Player = 1” then stop the animation but not otherwise.

It is fixed!, these are the commands that did the job: quiestsadf .

Again thank’s for the help, you’ve given me really good insight.

1 Like