running when you double press the button and combo

Started by ATLUS, May 09, 2009, 10:13:58 AM

Previous topic - Next topic

ATLUS

This simple example shows how to do that would be choosing our hero ran when double clicking on the button control. + lite combo in fighting games

controls:
left key - walk left
right key - walk right

left left - run left
right right - run right

down up - go up on 10 pixels(lite combo=))
PlayBASIC Code: [Select]
; PROJECT : runs
; AUTHOR : ATLUS
; CREATED : 09.05.2009
; EDITED : 09.05.2009
; ---------------------------------------------------------------------

setfps 60
Ltime=timer()//////
Rtime=timer()//////timer actions
combotime=timer()//

x_pos=400
y_pos=300

speedpause=200;time to pause

walk=1
run=3
do

cls rgb(0,0,0)

circle x_pos,y_pos,20,1
//left run and walk
///////////////////////////
if leftkey()=true ; left key on and stop timer
Ltime=timer()
x_pos=x_pos-walk
endif
if leftkey()=false; so now start pause of two key
escLtime=timer()-Ltime
endif
if leftkey()=true and escLtime<=speedpause; if need run
x_pos=x_pos-walk-run
endif
/////////////////////////
//right run and walk
if rightkey()=true
Rtime=timer()
x_pos=x_pos+walk
endif
if rightkey()=false
escRtime=timer()-Rtime
endif
if rightkey()=true and escRtime<=speedpause
x_pos=x_pos+walk+run
endif
///////////////////////////
///*****************combo
if downkey()=true
combotime=timer()
endif
if downkey()=false
combogametime=timer()-combotime
endif
if upkey()=true and combogametime<=speedpause
y_pos=y_pos-1
endif
///////////////////////


text 10,10,"time combo:"+str$(comboGametime)
text 10,20,"time left:"+str$(escLtime)
text 10,30,"time right:"+str$(escRtime)
if y_pos<10 then y_pos=590
if x_pos>800 then x_pos=0
if x_pos<0 then x_pos=800
sync
loop