Here:
rem setup screen
sync on
sync rate 60
backdrop on
color backdrop 0
hide mouse
rem main loop
do
rem do something...
rem damage goblin
if goblin_collision=1 and gob_has_hit=0: rem or any type of collision that will damage the goblin
dec gob_life
gob_has_hit=1
endif
rem reset hit variable if goblin is not being hit
if gob_has_hit=1 and goblin_collision=0 then gob_has_hit=0
rem kill goblin
if gob_life<1 then kill_goblin
rem refresh screen
sync
rem end of main loop
loop
And here is an example using it:
rem setup screen
sync on
sync rate 60
backdrop on
color backdrop 0
hide mouse
rem make a goblin
make object cube 1,10
rem main loop
gob_life=3
do
rem position camera
position camera 0,0,-50
rem user info
center text 320,20,"Click mouse to hurt goblin..."
if gob_life>0 then center text 320,40,"Lives left : "+str$(gob_life) else center text 320,40,"DEAD!"
rem damage goblin
if mouseclick()=1 then goblin_collision=1 else goblin_collision=0
if goblin_collision=1 and gob_has_hit=0: rem or any type of collision that will damage the goblin
dec gob_life
gob_has_hit=1
shake#=50
endif
rem reset hit variable if goblin is not being hit
if gob_has_hit=1 and goblin_collision=0 then gob_has_hit=0
rem kill goblin
if gob_life<1 then kill_goblin=1
if kill_goblin=1 then hide object 1
rem damage goblin
inc s,10:s=wrapvalue(s)
shake#=curvevalue(0,shake#,30)
sine#=sin(s)*shake#
position object 1,0,shake#,0
rem refresh screen
sync
rem end of main loop
loop
Suicide is away of telling God, You can’t fire me I quit !!!!!