onKeyDown(key: Key | Key[], action: (key: Key)=>void): KEventController

Register an event that runs every frame when a key is held down.
// move left by SPEED pixels per frame every frame when left arrow key is being held down
onKeyDown("left", () => {
    bean.move(-SPEED, 0)
})

since

onKeyDown(action: (key: Key)=>void): KEventController

Register an event that runs every frame when any key is held down.

since

kaplay logo

Misc