I am currently working on a project to make a stickman fight game (much like http://www.stickpage.com/xiao9play.shtml), however, I've came across a slight problem. I am hoping to make the user be able to:
walk left/right (LEFT/RIGHT
run left/right (SPACE + LEFT/RIGHT)
jump left/right/standing (UP + LEFT/RIGHT)
do multiple attacks on different key presses, incl. with combination of jump key (A/S/D/F) and (SPACE + A/S/D/F)
However, when doing attacks, I would like some sort of script that can detect combinations within a certain time interval. Eg. say the attack combination was A then S, is there a way in which I can make it detect whether S was pressed within a certain time interval after A, if so, it will then do something else.
Pseudo code:
Code:
If A is pressed Then
Do Attack1
End If
If A then S pressed < 0.5 secs Then
Do Attack2
End If
If A then S pressed > 0.5 secs Then
Do Attack1
End If
Hopefully you can understand what my problem is and that you can be of some assistance.
Thanks for the reply azwaldo, however, i can't seem to get it to work!
Could you perhaps try applying it to my problem and then post the script to see where i am going wrong.
Sorry, I didn't make myself very clear...like just make it start on frame 1 (perhaps put 'no action' here), then if it wasn't pressed in time then goto frame 2 (here put 'wasn't pressed in time') then if it was pressed in time, goto frame 3 (here put 'was pressed in time').
would you like an animation worked up from scratch? (probably not*)
what have you come up with so far ?
can you zip up an .fla or attach a .txt file with something?
there would be many ways to approach the effect you are describing. but, the devil is often in the details