Workshop › Bomberman-style Arena › Step 17 of 42
Every frame, every fuse gets one shorter. A bomb whose fuse reaches 0 explodes; for now exploding only removes it.
```js
function explode(bomb) {
bombs = bombs.filter((b) => b !== bomb)
}
for (const b of bombs) b.fuse -= 1
for (const bomb of bombs.filter((b) => b.fuse <= 0)) explode(bomb)
```b.fuse -= 1 takes one frame off each fuse.bombs.filter((b) => b.fuse <= 0) makes a list of the bombs whose time is up; each of them explodes.explode keeps every bomb except this one: !== means "is not the same".function update() { write explode.update, under updatePlayer(), write the two fuse lines.Skills: Game states, The game loop
← Bombs are in the way Fire! →