We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
It returns a Vector 2D Object and the movement input from keyboard are mapped to this object.
import { getDirection } from './bottlecap/keyboard.js'; const direction = getDirection(); player.pos.x += direction.x * SPEED * dt; player.pos.y += direction.y * SPEED * dt;
Checks if a key is down
import { keyDown, KEYS } from './bottlecap/keyboard.js'; if(keyDown(KEYS.SPACEBAR)) { player.jump(); }
There was an error while loading. Please reload this page.