Workshop › Bomberman-style Arena › Step 13 of 42
A bomb is a tile and a fuse: how many frames until it goes off. dropBomb puts one on the tile the player stands
on. The player may be between two tiles, so tileOf rounds to the nearest one.
```js
const FUSE = 150 // frames until a bomb goes off
let bombs // { r, c, fuse }
bombs = []
const tileOf = (m) => ({ r: Math.round(m.y), c: Math.round(m.x) })
function dropBomb() {
const t = tileOf(player)
bombs.push({ r: t.r, c: t.c, fuse: FUSE })
}
```Math.round rounds to the nearest whole number: 2.4 → 2, 2.6 → 3. So tileOf gives the tile a mover stands on.({ ... }) returns an object from a short function; without the brackets { would start a function body.dropBomb adds { r, c, fuse } to bombs.DIRS write FUSE.let held write let bombs; in reset, above held = [], write bombs = [].walkable write tileOf.function update() { write dropBomb.Skills: Game states
← Walk Space drops, bombs show →