Game Palette: Keyboard demo

This browser does not support HTML5 canvas; it is required to use the Game Palette library

WASD or the arrow keys move both dots; Space or F fires. Enter lets you choose your own keys, and Backspace puts the usual ones back.

Each control is one KeyInput with two keys, and the same isPressed moves both dots. The left dot moves at the same speed in every direction; the right one simply adds the two directions together, so it goes about 1.4 times as fast on a diagonal (try holding up and right). Fire counts two ways: by its keyDownFunction, once a press, and by isPressed, once a step for as long as it's held. A KeyInput for each key, on its own, shows which keys are held, and lets you press a new key for each control, which is then set as that control's key.

See User Input in the manual.

All demos