so I am trying to change between “walkst” to “walk” but no matter what I try, the animation freezes on the first frame of “walk” and when it changes animations between “idle” or “run”, they are also stuck on frame 1 for each animation
Use “Trigger Once” on any conditional that results in an animation change action.
sorry, how do I do that? I’ve never made a game before and only started this last week
Hi try to start from here there is a lot of examples https://gdevelop-app.com/game-examples-starters
Plus you maybe go to YouTube and type GDevelop tutorial a lot of channels will help you to learn how to make games with GD
yeah, none of those have helped me fix the animation issue, but still helped in other areas, thanks though
The “Trigger once” should fix it. You see those light grey “Add condition” lines in each event? Click on that, select the Other Conditions tab > Advanced and clink on “Trigger once while true”.
The problem you have with your events is that you can have multiple conditions that are met. The player’s animation can be finished, the payer can be can be stopped and the left shift key can be pressed all at the same time. Which animation do you want displayed?
Each event is independent of the other ones (unless they’re a subevent). Take that into consideration when you create them
so, I tried the trigger once command, none of the animations freeze anymore but “walkst” still doesn’t play
You need to understand this.
That’s right, because that’s what the events are telling GDevelop to do - in that screen snip you provided, if the conditions are met to set animation to walkst, then the subevent is also executed (it has no conditions), and in this case the walk animation is played.
Here’s what the first event and it’s subevent are in pseudo code, if that helps:
If player hasn't stopped and it's the first time this has happened since the last frame update
set player animation to walkst
set player animation to walk
It doesn’t play because you have another event as a subevent of it. It will try to start “walkst” but then immediately go to “walk” because “walk” is a subevent of the other event above it.
You cannot have two animation actions in the same event, so you’ll need to set up some sort of conditions that make the “walk” animation event separate from the “walkst” one, and make it no longer a subevent.
really sorry for being an incredibly dumb bother, but I am having a very difficult time understanding what to do, heres my last try before I scrap the “walkst”
You have 2 conflicting conditions:
Both “The overall speed of the player > 170” AND “The overall speed of the player >= 110” can be true at the same time. So you still have a conflict and will need to modify the conditions to be something that cant happy at the same time.
this should be working then right? no conflicts? it still doesn’t work sadly. if I set run animation to =180 instead of >=180, run doesnt work. either way “walkst” either only plays in place of “walk” or is the only one that doesnt play
At a high level, some issues here:
- “The animation of player is finished” event needs a trigger once.
- “Player is stopped” and “The animation of Player is finished” events can both be true at once, they’ll definitely conflict.
Are you using a movement behavior at all? I’m not familiar with “the overall speed of” conditions so I’m not sure if they’re specific to a certain behavior or not.
added trigger once to animation finished event, didn’t change anything
changes player is stopped to overall speed =0, also didn’t change anything, but the animation of player is finished should be in reference to the last frame of “walkst” right?
“overall speed of” is just the condition “speed” in the select a condition tab, which is under movement.
I think those conditions may be miscategorized, and are meant to be exclusively used with the pathfinding behavior. I don’t think they’ll work if you’re not using that behavior.
What movement behavior are you using to move your character?
uh its really messy, and I’m sure I could simplify the Lshift ones, but I got busy hung up on trying to fix this issue, but just “key pressed”
Oh, you’re manually creating movement forces.
Unfortunately, I don’t think these conditions are going to detect anything for you. (I’m trying to confirm whether they’re miscategorized or not, but likely won’t hear anything until tomorrow).
Sadly, I also don’t think you can detect forces on an object at all. If you’re going to make forces on an object, you will probably need to also make some kind of tracking variable, and use that instead.
Something like adding an action to your “d is pressed” event that modifies an object variable of “MoveType”, then sets it to “Walk”. Then another one on your run event (let’s say LShift+D one) that sets the same variable to “Run”.
Then you set up an event that says "if text of object variable “MoveSpeed” = “Walk” | “Set animation to blah”, etc.
You also have some large conflicts that are going to cause issues for you in your events:
- Never leave any parameters in any event blank. Ever. If you don’t want an a force applied, put a 0, never leave blank.
- If you have similar buttons, they should be subevents in the same events.
D key is pressed | (No actions)
(subevent 1) Trigger Once | Flip horizontally : no
(subevent 2) Lshift is pressed (Inverted) | Add to player an instant force of 120 p/s on X and 0 p/s on Y
| Set text of variable "MoveType" of player = "Walk"
(subevent 3) Lshift is pressed | Add to player an instant force of 180 p/s on X and 0 p/s on Y
| Set text of variable "MoveType" of player = "Run"
Then you can remove the separate Lshift+D event you have below, etc.
Edit: I’ve received confirmation these events seem like pathfinding behavior only. I’ve submitted an issue on the github to get their categories updated to avoid confusion/or find the source of the issue in the future. Mislabeling of Movement Conditions in Common conditions. · Issue #2811 · 4ian/GDevelop · GitHub
These conditions should work properly. They are to be used with forces, which is what is properly done here.
Be sure that you’re testing for a speed between a range (for example: the speed is > 90 and the speed is < 180). Otherwise multiple events will be applied at the same time and so the animation will be stuck.
Yep, 4ian confirmed some stuff earlier, the web app wasn’t updated with the new naming yet.
After having updating to b112 on my local install, I can confirm these conditions work as expected for me.
That said, I would still recommend decoupling your animation changes based on speed, and using a variable instead as I listed above. Why? Because if you ever change your speeds you want to use (run to 160, for instance), you will now have to update every event and condition that has the old 180 speed listed.
By using the variable you never have to change anything other than the speed of the original condition.