Page 1 of 1

GetKeyState

PostPosted: Fri Oct 10, 2003 8:54 am
by jazz_e_bob
Can I please trouble someone for a demo of the usage of GetKeyState?

:)

PostPosted: Fri Oct 10, 2003 12:17 pm
by makslane
Move a actor to left or right, when left or right keys pressed in "Draw actor" event

1) Create an actor
2) Add a "Draw actor" event
3) Add Script code

Code: Select all
char *key = GetKeyState(); //Get entire keyboard state

if(key[KEY_RIGHT] == 1) //Test if right key is pressed
{
  x = x + 5; //Move actor to right
}

if(key[KEY_LEFT] == 1) //Test if left key is pressed
{
  x = x - 5; //Move actor to left
}

PostPosted: Fri Oct 10, 2003 12:21 pm
by jazz_e_bob
Cheers mate! 8)