Workshop › Endless Runner › Step 1 of 19
Jump over cacti and duck under birds while the world speeds up. Jump physics, variable jump height, random spawning and forgiving hitboxes.
We are building an endless runner: a runner jumps over cacti while the world rushes by, faster and faster. First the scene: a light sky and a thin ground line.
```js
const canvas = document.getElementById('game')
const ctx = canvas.getContext('2d')
const GROUND = 180 // y of the ground line
ctx.fillStyle = '#f8fafc'
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.fillStyle = '#475569'
ctx.fillRect(0, GROUND, canvas.width, 2)
```canvas is the drawing area, ctx its drawing pen.GROUND names the height of the ground once: 180 pixels from the top (y grows downward).Write the lines under the comments, then press Run.
Skills: Drawing on a canvas