Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: The Almighty Metroid on Sat 28/02/2009 20:25:07

Title: Using the Arrow keys Instead of the mouse...
Post by: The Almighty Metroid on Sat 28/02/2009 20:25:07
*clears throat* Hello AGS community! As you can tell by the title I need help making AGS use the arrow keys instead of the mouse...

I know if I do it one way it'll make the playable person move until another key is pressed.

What i need to know is how do I script it to where you press the arrow key for 2 seconds the character moves for 2 seconds (did that make sence?)
Title: Re: Using the Arrow keys Instead of the mouse...
Post by: on Sat 28/02/2009 21:20:40
If you are using a recent version of AGS, the Default Game template already deals with keyboard movement, so you don't need to script too much on your own. The code in Keyboard_movement_102 is pretty simple, and all you need to do is change "movement tapping" to "movement pressing". (Tapping means the player walks into a direction until he hits something/another key is pressed)
Title: Re: Using the Arrow keys Instead of the mouse...
Post by: The Almighty Metroid on Sat 28/02/2009 21:48:38
Thanks ill try that.. ill notify of resutls!
Title: Re: Using the Arrow keys Instead of the mouse...
Post by: The Almighty Metroid on Sat 28/02/2009 21:51:28
my results are... Where can i find that.. is it in .asc or .ash?
Title: Re: Using the Arrow keys Instead of the mouse...
Post by: on Sat 28/02/2009 22:32:58
Quote from: The Almighty Metroid on Sat 28/02/2009 21:51:28
my results are... Where can i find that.. is it in .asc or .ash?

asc. ash are always header files (like in C/C++), where stuff gets defined.

Edit: My bad, sorry. It's in the global script (still asc), in game_start:


function game_start() {   
  // Put the code all in a function and then just call the function.
  // It saves cluttering up places like game_start.
  initialize_control_panel();
  // Use the KeyboardMovement module to, per default, replicate the standard
  // keyboard movement of most Sierra games. See KeyboardMovement.txt for more info
  KeyboardMovement.SetMode(eKeyboardMovement_Tapping);
}


Just set the mode there, in the last line.