collapse each turn based session into a function.
something to this effect allthough its a little buggy you get the idea.
rem setup
sync on : sync rate 60 : randomize timer()
make matrix 1,100,100,10,10 : position matrix 1,0,0,0
ink rgb(255,255,255),1 : set text font "verdana" : set text size 14 : set text opaque
rem timers
dim TimeRef(2)
TimeRef(1) = Timer()
TimeRef(2) = Timer()
dim TimeDelay(2)
TimeDelay(1)=10
TimeDelay(2)=10
rem main game loop
disable escapekey : while escapekey()=0
Player()
Monster()
sync : endwhile
rem cleanup and end
undim TimeRef(2)
undim TimeDelay(2)
delete matrix 1
end
rem functions
function player()
disable escapekey : while escapekey()=0
if TimeDelay(1) > = 0
exit
else
If Abs(Timer()-TimeRef(1))>1000
If TimeDelay(1)
TimeDelay(1) = TimeDelay(1) - 1
endif
TimeRef(1)=Timer()
endif
endif
text 10,10,"players turn to move : press escape to skip turn :"+STR$(TimeDelay(1))
sync
endwhile
Monster()
endfunction
function Monster()
disable escapekey : while escapekey()=0
if TimeDelay(2) > = 0
exit
else
If Abs(Timer()-TimeRef(2))>1000
If TimeDelay(2)
TimeDelay(2) = TimeDelay(2) - 1
endif
TimeRef(2)=Timer()
endif
endif
text 10,10,"monsters turn to move : press escape to skip turn"+STR$(TimeDelay(2))
sync
endwhile
Player()
endfunction
fall down seven times, stand up eight