LoginLogin

Timed attacks

Root / Programming Questions / [.]

KomodoCreated:
It's in all the mario rpgs where if you press the right button at just the right time you can get a more powerful attack. How would I attempt to do this in smilebasic?

The only thing I can really think of is a counter in a loop to see how many frames you hold the button down for
IF BUTTON(1)==16 THEN
WHILE !BUTTON(3)
CT=CT+1
WAIT 1
WEND
IF CT>30 AND CT<60 THEN
?"KABLAMO: 1/2-1 SECOND LONG ATTACK!
ENDIF
ENDIF

I think you could use a bar/gauge like in golf games, mark a small area somewhere in the bar. Have it fill up at a speed, and then detect if the button is pushed when the bar is between the marks. Could use GFILL probably.