[SOLVED] Switch between Shooting/Running and Running Animation

(Before making this post I tried searching the forums for answers to no avail, need help pls)

I want my character to have a shooting animation for standing, running, crouching and jumping, but I’ve already hit a roadblock at just running. I initially wanted my character to switch between the running and shoot/run animation when the attack button is pressed, but right now it’s only playing the first frame of the animation. I had the same problem for the standing animation which I fixed, but the running animation wasn’t able to be fixed the same way. If there is a more optimal way of making this work I am open to suggestions :slight_smile:

(I had to zoom out the events list as I cant yet post multiple embeds, apologies)


The problem is that the animation keeps changing, first (in the movement animations) it’s changing to Run, then (in the attacks) it’s changing to RunShoot. So the animation freezes on the first frame.

You can build the events like this:

| Player is on floor
| LControl is NOT pressed
     | Player is moving        → Change animation to "Run"
     | Trigger once

     | Player is NOT moving    →  Change animation to "Idle"
     | Trigger once

Make sure to always add condition checks to stop animations from overlapping, like the player is on floor so that the event doesn’t run when the player is jumping or falling.

1 Like

I would take a slightly different approach. Instead of setting the animation in different events, I’d set a scene string variable to the animation name and add an event at the end of the scene’s event list, setting the player’s animation to that variable string.

This way the variable may change over the course of a frame, but if it ends up the same as the previous frame, then the animation won’t get reset.


Hello! I’ve finally made some progress after trying this. The shooting animations now display as they should, though now the whole animations stops at the last frame instead of going back to the idle/running animations. Furthermore, attempting to add “LControl is NOT pressed” makes it so that the attack button needs to be held down for the whole animation to be played. Are there ways around these problems?

I’m quite new to GDevelop, and programming as a whole so I still have no idea how to implement this. Thank you for the help though and I’ll see if I can find out how to implement this approach into my game!

It’s fairly straight forward. Here’s an example of how it could be done, using a scene string variable called “playerAnimation”:


Thank you very much! I’ll try to implement this into my game right now.

I’m still trying to fully understand the scene string variable approach as my main priority is to make a functioning game for my college finals, but I’ve solved my current issue with the animations not working as intended. Thank you all for your help!

My solution was to separate the “LControl is pressed” event from “Is on floor” event, and then place the “Animation of (object) is finished” events as their own events under “Is on floor”, then have “LControl” be as sub-event of “Is on floor” with the set animation events as sub-events of that.

I will continue to try to make my game as efficient as possible and be open to advice but my main issue has been solved, thanks guys!