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)
})

sincev2000.1

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

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

sincev2000.1

kaplay logo