controls

Started by Cpt Ezz, Sat 14/06/2008 01:46:03

Previous topic - Next topic

Cpt Ezz

hi
how do i make a key on the keyboard do something like shift = jump in the game


skuttleman

serach for IsKeyPressed() in the help file.

TwinMoon

It would be easier to not use keys like SHIFT, ALT or CTRL since they don't call on_key_press.

If you want to use the space bar (space = keycode 32) add this to on_key_press (in the global script):

Code: ags

if (keycode==32) {
  //enter jump code here
}


(You can find all the key codes under ASCII code table in the help file)

To make a character jump you could use character.z  (.z in the help file), at least in a 'regular' adventure game. If you're making a platform game, you might change character.x and character.y directly.

Cpt Ezz

thank you very much

SMF spam blocked by CleanTalk