making a "stamina" meter

This forum is currently in read-only mode.
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • anyone still lurking here at the old support forum?

    if there is someone kind enough to help, i have 2 issues:

    1. so im making a sort of stamina meter (ability meter to be precise). i have a global var that is set to always fill up to maximum of 500 units. i have these abilities in game that the player can unlock and use that take set amount of units from the "stamina meter". my issue is that the global variable can go to a negative number, and i dont want that, because it kind of messes up that recharge balance. if i have an ability that takes 600 units, it reduces the global var to -100. how can i make it so that abilities drain the global var only down to 0 and not further down to negative numbers?

    2. next issue is connected to the first, kinda: im planning on making a level up system for the "stamina bar", so that the player gets more powerful the more he plays. so occasionally (from killing enemies mostly), the stamina bar gets bigger, starting from that 500 units. how would i have to implement that? . do i have to use another variable to reference that max "stamina" value? that level up (increasing the max value of global var) confuses me, but it would be critical to the nature of the game.

  • 1. insert a condition: if GlobalVar <0 set GlobalVar to 0

    2. yes you can but i need to know more details about it

  • thanks for answering!

    that first issue was embarrassing, how did i not figure that out, ugh.. but much appreciated!

    but so, the second issue. ill try and keep it simple for the sake of discussion:

    right now i have that max 500 units for global var. (stamina).

    i was thinking of making another global var, lets say "level up".

    every 10 enemies killed levels up, global var sets to 0 again. no problem so far.

    that level up adds, say +50 to that 500 globar var, so the first level up would be 550.

    the problem is:

    to regenerate the stamina bar over time, i have a condition/action as follows:

    always--> if global var (stamina) is less than 500 ---> add 2 to global var (stamina).

    that becomes a problem if im going to level up the max stamina over that initial 500.

    basically this is the whole issue im having here.

  • thanks for answering!

    that first issue was embarrassing, how did i not figure that out, ugh.. but much appreciated!

    but so, the second issue. ill try and keep it simple for the sake of discussion:

    right now i have that max 500 units for global var. (stamina).

    i was thinking of making another global var, lets say "level up".

    every 10 enemies killed levels up, global var sets to 0 again. no problem so far.

    that level up adds, say +50 to that 500 globar var, so the first level up would be 550.

    the problem is:

    to regenerate the stamina bar over time, i have a condition/action as follows:

    always--> if global var (stamina) is less than 500 ---> add 2 to global var (stamina).

    that becomes a problem if im going to level up the max stamina over that initial 500.

    basically this is the whole issue im having here.

    Use two variables, DefaultHP (initial value set to 500) and LevelUPsHP (initial value set to 50), then:

    NB: you have to remember to "update" when your Hero increase Level adding "tot" at the LevelUPsHP value

    EX: on level2 reached -> set LevelUPsHP to 100

    on level3 reached -> set LevelUPsHP to 200

    ecc

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • excellent! i got it now. i was on the right track but this made it all clear.

    much appreciated!

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