I use Sugarcube.
Imagine a space game where you have an oxygen tank. And let's say, every passage, the $air variable goes down by 1, and $maxAir, the full-capacity of the oxygen tank, is set at 20.
But you can collect tools to upgrade $maxAir, meaning you can stay outside for longer periods of time before having to refill your oxygen tank. Let's say you can upgrade $maxAir to 50, 75 and then 100.
Is there a single bit of code you can do to code the $maxAir variable on a scale of 0-100, where 100% is $maxAir and the percentage displayed is whatever $air is relative to $maxAir? Or would I have to code each upgrade differently?
Like 10 $air with a $maxAir of 20 would display 50%, but 10 $air with a $maxAir of 50 would display as 20%
Any help is appreciated.
Comments
So try:
As usual, I was trying to gerrymander some overly complicated and far more inefficient method on my own when the answer was this simple all along.
Thank you.