Ok, pc nerd, the code I was referring to was in my previous posts. I'll try and explain again here.
for E=0 to -1000 step -1
if ENERGY#=E
ENERGY#=10
endif
next E
Does do the job, but loops through 1000 times before it completes.
Whereas:
if ENERGY#<1 and ENERGY#>-1001 then ENERGY#=10
does the job with one instruction.
Equally well, if all you are worried about is if ENERGY# gets below 1 then:
if ENERGY#<1 then ENERGY#=10
would also do the job.
There is no reason whatsoever to step through the values, checking each one.
If you are tying in your player's movement speed to their remaining energy, work out the equation that relates the two.
Eg, if they move at SPEED=10 at 100% ENERGY and lose 1 SPEED for each 10% ENERGY then:
SPEED=(ENERGY-100.0)/100.0*10.0+10
would update your player's speed with one line, called once per game loop.
"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library
First you Dream, then you ... - Neil Gaiman, 2001