Code:
include, plotscr.hsd
include, project1.hsi
# global variables with ID 1. IDs don't matter much, just make sure each variable has a different ID number
global variable (1, hunger)
plotscript,HudLoop,begin
variable (hud, time)
hunger:=0
hud:=load medium enemy sprite (0)
put sprite (hud, 0,0)
#exit loop if you die of hunger
while (hunger << 50) do, begin # change this
decrement(time)
if (time == 0) then (
increment(hunger)
time := 300 # change this
)
replace medium enemy sprite(hud, hunger)
wait(1)
end
gameover
end
include, project1.hsi
# global variables with ID 1. IDs don't matter much, just make sure each variable has a different ID number
global variable (1, hunger)
plotscript,HudLoop,begin
variable (hud, time)
hunger:=0
hud:=load medium enemy sprite (0)
put sprite (hud, 0,0)
#exit loop if you die of hunger
while (hunger << 50) do, begin # change this
decrement(time)
if (time == 0) then (
increment(hunger)
time := 300 # change this
)
replace medium enemy sprite(hud, hunger)
wait(1)
end
gameover
end
Note that you can write "x -= 1" instead of "decrement(x)".
I made 'hunger' into a global variable. This allows you to change it from another script, like this one, which you can attach to a textbox (with a "Run script X Always"). Then attach the textbox to an item as the On Use action.
Code:
plotscript, decrease hunger by 2, begin
hunger -= 2
# don't allow negative hunger, it would break the script above
if (hunger << 0) then (hunger := 0)
end
hunger -= 2
# don't allow negative hunger, it would break the script above
if (hunger << 0) then (hunger := 0)
end



