How do I Make a Working Stamina Bar

0 favourites
  • 12 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • Hello there, So I'm making a chasing game and I'm trying to find out why when I hold the shift key the stamina bar's width keeps getting wider instead of smaller.... Could use some help!

    Thanks in regard, AfterLife

  • Can you post a capx, or a picture of your events?

  • Can you post a capx, or a picture of your events?

    Here hope this works! https://onedrive.live.com/redir?resid=9 ... ile%2ccapx

  • The logic is randomly swapping between a global variable called Stamina which is always between 0-300 and a local variable on player called Stamina which keeps reducing constantly into negative amounts every tick and never recovers. The local variable seems broken, I don't see where it relates to the bar? If you set up two text boxes separately to display Global Stamina and Player Stamina every tick you can see what they're doing. Too confusing for me to look through as it just says Stamina everywhere.

  • The logic is randomly swapping between a global variable called Stamina which is always between 0-300 and a local variable on player called Stamina which keeps reducing constantly into negative amounts every tick and never recovers. The local variable seems broken, I don't see where it relates to the bar? If you set up two text boxes separately to display Global Stamina and Player Stamina every tick you can see what they're doing. Too confusing for me to look through as it just says Stamina everywhere.

    So should i stick with the global or instance

  • Either one but make sure it's only one. If you plan to have stamina bars for enemies and other characters then using local variable would probably be best, then linking only the player stamina to the UI bar. If it's just the player that has stamina then just use a global variable. If it's still not working as intended with the global variable 'Stamina' then we can take another look.

  • Either one but make sure it's only one. If you plan to have stamina bars for enemies and other characters then using local variable would probably be best, then linking only the player stamina to the UI bar. If it's just the player that has stamina then just use a global variable. If it's still not working as intended with the global variable 'Stamina' then we can take another look.

    So I'm new do you think you could switch it for me?

    If not thats fine and thank you for the tips!

  • I can fix up the logic but it'll be later on today. If someone else fixes it in the meantime that's fine, otherwise I'll take a look.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I can fix up the logic but it'll be later on today. If someone else fixes it in the meantime that's fine, otherwise I'll take a look.

    Thanks man!

  • I've done it here in 2 easy events. No need for variables in the end, it relies on the bar width only. Have a look. I've kept your old logic in there but disabled.

    https://dl.dropboxusercontent.com/u/495 ... dited.capx

    You MAY need to relate it to a global variable in future, it's easy to adjust, or you could still rely on the width of the bar if you wish i.e. if width=1 then show character's tired animation, reduce speed etc something like that.

  • I've done it here in 2 easy events. No need for variables in the end, it relies on the bar width only. Have a look. I've kept your old logic in there but disabled.

    https://dl.dropboxusercontent.com/u/495 ... dited.capx

    You MAY need to relate it to a global variable in future, it's easy to adjust, or you could still rely on the width of the bar if you wish i.e. if width=1 then show character's tired animation, reduce speed etc something like that.

    Thank you so much!

  • I've done it here in 2 easy events. No need for variables in the end, it relies on the bar width only. Have a look. I've kept your old logic in there but disabled.

    https://dl.dropboxusercontent.com/u/495 ... dited.capx

    You MAY need to relate it to a global variable in future, it's easy to adjust, or you could still rely on the width of the bar if you wish i.e. if width=1 then show character's tired animation, reduce speed etc something like that.

    Thank you so much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)