This could quickly get complex if you have many actions. What this does is try to create a sort of "action listener" like you would see Java. If the character starts moving, it'll through a flag up, but the flag only stays up for 1 loop. Same thing happens for when the character stops moving. It's designed to check if the action has happened, not if it
is happening. I used sound clips so it's easier to know if its been detected or not. Showing text for 1 loop might not be visible.
sync on
sync rate 30
load sound "E:\stuff\media\ric1.wav", 1
load sound "E:\stuff\media\dry.wav", 2
type Listeners
Moved as integer
Stopped as integer
endtype
listener as listeners
listener.Moved = -1
listener.Stopped = -1
rem object number for player character
oPlayer = 1
make object cube oPlayer, 20
position camera -100,100,-100
point camera 0,0,0
DO
gosub _user_controls
if listener.Moved = 1 then play sound 1
if listener.Stopped = 1 then play sound 2
sync
LOOP
_user_controls:
listenerFlag = 0
if upkey() = 1
move object oPlayer, 0.5
if listener.Moved = -1
listener.Moved = 1
listener.Stopped = -1
else
if listener.Moved = 1 then listener.Moved = 0
endif
else
if listener.Moved = 1 OR listener.Moved = 0
listener.Moved = -1
listener.Stopped = 1
listenerFlag = 1
endif
endif
if listenerFlag = 0
listener.Stopped = -1
endif
return
PETA - People for the Eating of Tasty Animals