Keyboard movement
Move a sprite with WASD or arrow keys, polling input each frame with delta-time velocity.
Notes
- Click the playground first so the iframe receives keyboard focus.
createCursorKeys()gives youcursors.left/right/up/down/space/shiftready to poll.addKeys({ up: 'W', ... })lets you offer WASD parity with a one-liner.- Movement is
speed * (delta / 1000)— pixels per second, framerate-independent. See The Game Loop. - Polling style fits continuous movement; events fit discrete actions (jump, fire). See Input.