Workshop › Bomberman-style Arena › Step 36 of 42
Walking onto an uncovered power-up takes it: it leaves the map and adds one bomb or one tile of flame.
```js
function pickUp() {
const t = tileOf(player)
const item = items.get(key(t.r, t.c))
if (!item || grid[t.r][t.c] !== ' ') return
items.delete(key(t.r, t.c))
if (item === 'bomb') maxBombs += 1
else power += 1
}
pickUp()
```pickUp looks at the item on the player's tile. With no item, or with its crate still there, it does nothing.update calls it right after moving the player.function dropBomb() { write pickUp.update, under updatePlayer(), write pickUp().Skills: Game states
← Uncover the power-ups Show the powers →