Input

Input Module

The Input Module lets you check what the player is doing with the keyboard and mouse.

Input is checked once per tick. A key or button is "down" for as long as it's held, and "clicked" for only the first tick after it's pressed.

The Input Module can be accessed with MDog.Input.Keyboard.method() and MDog.Input.Mouse.method().

Keyboard

Keys are named the same way as the browser's KeyboardEvent.key. Letters are always lowercase, even when shift is held, but other keys can change with shift, like "1" becoming "!". Some common keys are "a", "1", " " (space), "ArrowUp", "Shift", "Enter", and "Escape".

Space and the arrow keys won't scroll the web page while the game is running.

Mouse

The mouse position is in art pixels, the same as everything you draw. Mouse buttons are numbered 0 for left, 1 for middle, and 2 for right.

Mouse Info Methods

Mouse Cursor Methods