In my game, I'm making Psi's health a global variable. From the start, I want her to have some basic health and energy regeneration. How do you set the upper limits of this so a +1 health won't go higher than the variable?
Develop games in your browser. Powerful, performant & highly capable.
You can use the clamp instruction.
clamp(x,low,high) will be :
low if x < low
x if low < x < high
high if high < x
You can find it in the system expressions.
Thank you Guizmus!
I'm trying that right now but having a hard time gtting it in right. Could you be specific of how to set the global variable with it?
Here is an example. There is an heath regeneration of 1/sec, and you have buttons to add an substract heath. Events should help you see how to use this instructions.
Thank you for the example Guizmus!