-
Key Sequences
Does anyone know how to detect if a sequence of keys has been pressed, like the moves in say mortal kombat. I don't necessarily need someone to write some code, but if you want to it might help. What i really want is an explanation of how it can be done.
-
You'd probably want a set time, in milliseconds, of how long the user can wait before pressing the next 'combo' move. We'll call this Delay.
Use the GetAsyncKeyState API on a timer or Do..DoEvents..Loop sequence to get info on all of the keys.
Below is some pseudo-code, not ready for VB:
Code:
Do
Put current keystate Array() into LastKeystate Array()
GetAsyncKeyState calls for the key(s) you are monitoring.
Populate a keystate Array()
If there is another key in the sequence(s) pressed, and (GetTickCount - Varb <= Delay) Then fill in combo state or execute combo
Varb = GetTickCount
Other Routine(s)
DoEvents
Loop
I hope this gives you a somewhat vague :rolleyes: idea of how to do what you are looking for.