Workshop › Whack-a-Mole › Step 16 of 18
A hit should feel good: a "+1" will float up from the mole. First we keep a list of them: each hit adds one with its place and the time it was born, and each one is forgotten after 600 ms.
```js
let popups = [] // floating "+1"s: { x, y, born }
popups = []
popups.push({ x: hole.x, y: hole.y - 40, born: now })
popups = popups.filter((p) => now - p.born < 600)
```born, the time of the hit.filter keeps only the ones younger than 600 ms; it runs even when not playing, so the last ones still fade out.let best, write let popups.start, empty the list; in the listener, add a popup on a hit.filter line the first line of update.Skills: Arrays and objects
← Faster and faster Floating +1 →