Here's an example of how it's usually done:
dim statetable(5,5)
call stateinit: rem assumes this proc is defined elsewhere
rem it should initialize the statetable array
global plystate,plyx,plyy
iff load "background.iff"
load "playerbobs.abk"
load "soundeffects.abk",5
double buffer
get sprite palette
do
wait vbl
screen swap
on plystate+1 gosub state1, state2, state3, state4, state5
loop
rem first state
state1:
rem assumes plystate is the same number as the
rem bob image number to be displayed
Bob 1,plyx,plyy,plystate
rem transition to the next state according to the table
plystate = statetable[1,joy(1)]
inc plyx
return
state2:
Bob 1,plyx,plyy,plystate
plystate = statetable[2,joy(1)]
sam play 1,1: rem assumes this sound effect exists
return
...
Note that the state table can get quite large if you have special hidden moves in them. Note also, that the array that contains the state table should be square (equal rows and columns) so that the current state being passed in will have a corresponding state coming out.
I've left a lot up to you to define in the example but it should get you started.