How do I Create A Circular Stamina Bar System in GDevelop Like The One In The Legend Of Zelda: BotW and TotK?
Hello! I’m trying to find a solution on how to create a circular stamina bar like the one in The Legend of Zelda: Breath of the Wild and Tears of the Kingdom.
The Expected Result:
The bar should only appear when you click w, s, a, d (forward TOPDOWN movement) and disappear when it is tweened (linear movement) to full value, when you stop clicking any of the buttons (w, s, a, d). Also, as you can see in the video below, the tip of the bar (when reducing) is red (smoothly tweeting in and out of use with linear movement).
I needed to recreate your events to better understand the issue. I think it’s the line that’s adding an object when there’s zero objects. Yes, it has a trigger once but when the object is deleted the trigger once gets reset and the cycle starts again since I’m assuming the object variable’s default value is zero.
You might need to change stamina back to false or use an additional variable or condition.
Maybe, instead of tweening the value of the object that gets created, you could tween a scene variable or a player object variable. That way the stamina value wouldn’t be reset to zero everytime the shape painter was deleted and added to the scene.
Maybe if the events were split up so you could use a trigger once with the stamina is true event.
Stamina = true
Trigger once
… Number of objects is zero
There are just two more questions I’d like to ask. At the end of the stamina refill animation, the red and the background circle seem to disappear a bit slower than the green stamina wheel. Also, I would like the player to stop moving when the stamina has run out. How would I do this?
You should make parent event with condition stamina variable is false
Actually that is stupid
Like i told you FAILVARIABLE is your stamina
When its 0 it means you did not used up any
When its 360 you used up all
Kinda like going in revers think of it does not indicate how much stamina is left
BUT how much of stamina you used up
So when its 360 it means you used up ALL your stamina so you should not be able to move
SOOOOO
In that condition i mentioned above
Put
INVERTRTED FailVariable equal to 360
BUT like i told you you should add there some timer
Cause it should drop down as soon as you stop moving
So well you will see what i mean once you try it without timer
There should be a timer that starts when stamina reaches 360
AND only when you are not moving and that timer does not exist you should start regaining stamina
(You should delete that timer as soon as it reaches some value for example 1 sec or maybe half? your choice)
BUUUUT that is still stupid
Cause you will be immediately able to move as soon as you regain even 1 stamina and then get stuck as soon as you gonna try to move
That is why more sense would be simply to set player max speed to something LOW when you reached max stamina usage
Have walk and run modes (speeds)
Where NOT MOVING would regain stamina fast
Walking would regain stamina slowly
Running would drain stamina
Actually i never played that zelda you mentioned
But isnt it exactly like that in that game?
Sorry again, but how would you slow the refill and the use of stamina? I have tried multiplying and dividing. and adding and subtracting to the Fail Variable, but it only changes the starting position.