|
-
May 31st, 2001, 09:27 PM
#1
Thread Starter
Fanatic Member
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.
-
May 31st, 2001, 10:22 PM
#2
Good Ol' Platypus
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 idea of how to do what you are looking for.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|