Workshop › Connect Four › Step 3 of 38
The board has 7 columns and 6 rows of 64-pixel cells, and starts 96 pixels from the top, leaving room above it. We give these numbers names and paint the blue board.
```js
const COLS = 7
const ROWS = 6
const CELL = 64
const TOP = 96 // room above the board for the messages and the next disc
ctx.fillStyle = '#1d4ed8'
ctx.fillRect(0, TOP, COLS * CELL, ROWS * CELL)
```COLS and ROWS are the size of the board, CELL the size of one cell and TOP the room above the board.(0, TOP) and is COLS * CELL = 448 wide and ROWS * CELL = 384 high.ctx line, after an empty line, write the four constants.draw, under the background, leave an empty line and write the two blue lines.Skills: Drawing on a canvas
← A drawing function One hole →