Workshop › Puzzle Bobble-style Bubble Shooter › Step 24 of 31

The ceiling comes down

What we are doing

Now drop moves everything: the bubbles are placed lower, the ceiling that stops a shot is lower, and the ceiling is drawn as a thicker block.

```js
const cellPos = (r, c) => ({ x: R + c * 2 * R + (r % 2) * R, y: TOP + drop * ROW_H + R + r * ROW_H })

  if (y - R <= TOP + drop * ROW_H) return true

  // The ceiling comes down as a solid block.
  ctx.fillStyle = '#312e81'
  ctx.fillRect(0, 0, canvas.width, TOP + drop * ROW_H)
```

What it means

Your turn

  1. In cellPos, add drop * ROW_H + after TOP + .
  2. In touches, change the ceiling check.
  3. In draw, add the comment and use the new height for the ceiling.

Skills: Game states

All steps

  1. The night sky
  2. One bubble
  3. A grid of cells
  4. Draw the grid
  5. Bubbles that nest
  6. The shooter
  7. Aim upwards
  8. Turn with the arrows
  9. Aim with the pointer
  10. Fire!
  11. Fly
  12. Bounce off the walls
  13. Touching something?
  14. Stick into the grid
  15. Smaller steps
  16. Six neighbours
  17. Flood fill
  18. Three in a row pop
  19. Bubbles that fall
  20. Cut them loose
  21. Show the score
  22. Only useful colors
  23. Count the shots
  24. The ceiling comes down
  25. Win or lose
  26. The danger line
  27. The end message
  28. Play again
  29. Best score
  30. A dotted guide
  31. Build it yourself: swap bubbles