import kaboom from "https://unpkg.com/kaboom/dist/kaboom.mjs" kaboom({ width: 800, height: 400, background: [92, 148, 252], }) setGravity(1200) const player = add([ rect(40, 40), pos(80, 0), area(), body(), color(255, 0, 0), ]) add([ rect(800, 40), pos(0, 360), area(), body({ isStatic: true }), color(0, 255, 0), ]) onKeyDown("left", () => { player.move(-240, 0) }) onKeyDown("right", () => { player.move(240, 0) }) onKeyPress("space", () => { if (player.isGrounded()) { player.jump(500) } })