Workshop › Missile Command-style Defense › Step 5 of 35
Now the drawing reads the city objects: a standing city is a tall blue block, a destroyed one flat grey rubble.
```js
for (const c of cities) {
ctx.fillStyle = c.alive ? '#38bdf8' : '#44403c'
ctx.fillRect(c.x - 16, GROUND - (c.alive ? 14 : 4), 32, c.alive ? 14 : 4)
}
```cities objects; c.x is the city's middle.a ? b : c is a short "if": blue when alive, dark grey otherwise.GROUND - height keeps both standing on the ground.In draw, replace the city part (the fillStyle line and the for loop) with the new loop.
Skills: Drawing on a canvas
← Cities that can fall Move towards a point →