How to test for 2 key presses

Non-platform specific questions.

How to test for 2 key presses

Postby Just4Fun » Wed Jun 30, 2004 12:57 am

I understand how to check for a Key press, but how would I check for two Key presses?
if (KEY_1 && KEY_2)
do something
:?:
TIA
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Wed Jun 30, 2004 11:12 am

In a Key Down event, click with right mouse buttom to catch any key.
Add the Script Editor action:

Code: Select all
char *key = GetKeyState();

//Catch a+s keys
if(key[KEY_a] && key[KEY_s])
{
    //Action for a+s
}

//Catch a+d keys
if(key[KEY_a] && key[KEY_d])
{
   //Action for a+d
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Just4Fun » Wed Jun 30, 2004 7:57 pm

Thanks Makslane,
That is just what I needed... :lol:
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest