making a "stamina" meter

For questions about using Classic.

Post » Sun Oct 29, 2017 3:59 pm

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.
B
3
S
1
Posts: 14
Reputation: 453

Post » Sun Oct 29, 2017 7:05 pm

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

2. yes you can but i need to know more details about it
B
13
S
7
G
4
Posts: 429
Reputation: 4,184

Post » Mon Oct 30, 2017 12:03 am

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.
B
3
S
1
Posts: 14
Reputation: 453

Post » Mon Oct 30, 2017 7:07 am

kingstonwall wrote: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:
Image

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
B
13
S
7
G
4
Posts: 429
Reputation: 4,184

Post » Mon Oct 30, 2017 9:16 pm

excellent! i got it now. i was on the right track but this made it all clear.
much appreciated!
B
3
S
1
Posts: 14
Reputation: 453


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests