Learn by Building Workshop Skills GitHub Türkçe Workshop › Flappy-style Bird › Step 2 of 30
Paint the sky What we are doing Our first drawing: the whole canvas becomes a light sky blue. Drawing is always two moves: pick a color, then fill a
shape with it.
```js
ctx.fillStyle = '#70c5ce'
ctx.fillRect(0, 0, canvas.width, canvas.height)
```What it means
ctx.fillStyle = '#70c5ce' picks the fill color, a sky blue.
ctx.fillRect(x, y, width, height) fills a rectangle. 0, 0 is the top-left corner, and canvas.width and
canvas.height (400 and 600) make it cover everything.
Your turn Leave an empty line under const ctx = ..., write the two lines, then press Run .
Skills: Drawing on a canvas
← Get the canvas and the pen Draw the bird →
All steps Get the canvas and the pen Paint the sky Draw the bird A function that draws A function that moves The game loop Gravity A flap Space, Up arrow or a tap Wait for the first flap The ground and the sky Tell the player A pipe as data Draw the pipes The world moves, not the bird A new pipe at a random height A pipe every 90 frames Remove the pipes you passed Is the bird level with a pipe? Through the opening Score each pipe once Show the score A function for a fresh start Try again One place where the game ends Remember the best score Show the best score The same speed on every screen No catching up after a pause Build it yourself: a medal