Key Down

From Game Editor

Revision as of 11:20, 11 July 2009 by Skydereign (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Key Down is a very helpful event, that is used in almost all games. As it sounds, this event triggers upon the pressing of a key designated in the Key Down settings.

Image:Key_Down_Event.png


Keys

This field is mandatory to add an action. In this, you can hold 12 different keys, or a sequence of keys, depending on how it will be used. Execute when chooses how the key input will effect the event. By default, Execute when is set to At least one key is pressed. That means by default, any key on the list will trigger the event. Also, Repeat is set to Enable, meaning it will execute every frame, until all keys are no longer pressed. Almost all keys are available for this event. Certain globally used keys may not work, as they might be global key bindings. You may also press right click for 'any' key. This will, as it says, trigger the action with any key down event.


Execute when

  • At least one key is pressed: This is the default setting, simulated in the Script Editor with or. Any key in Keys will trigger the event. This can be used for single keys, or for events that don't require a particular button, though the majority of these would use 'any' key.
  • All keys are pressed: This setting will require all keys to be pressed during at least one frame to activate. This may be used for puzzle games, or combo techniques, needing two succinct keys to perform a certain action.


  • Keys are pressed in order: This is a handy feature that allows for easy combos, passwords, cheat codes, and much more. Unlike the others, this is harder to replicate in Script, so it would not be a bad idea to use this. In order to activate a key down event with this setting, the keys must be pressed in the proper order, as they appear in Keys:. As previously stated, this is good for passwords and cheat codes.


Repeat

  • Enable: As it sounds, with repeat enabled, the event will continue to trigger every frame until the above requirements are no longer met. In events for moving, repeat is usually enabled. Some try to avoid this, as ChangeAnimation will have problems when using its default animation direction, but if that is changed to NO_CHANGE, then you may use repeat for these events.


  • Disable: This allows for individual events, useful for attacks, and can help with Moonwalking. The problem with Repeat is that animations will constantly be restarted, unless Repeat is disabled or NO_CHANGE is selected. Since the event is only triggered once, and the key or key combination will need to be repeated again to trigger the event, this prevents many problems with animations, or moonwalking all together.


Alternatives

The main alternative to this event is with Script Editor. In draw actor, with the call of GetKeyState, you can simulate certain settings of this trigger. Though, to simulate an event without Repeat enabled takes a little more planning. For further information, look at the KeyChange function.