Workshop › Doodle Jump-style Climber › Step 22 of 24
Sometimes a brown trap platform appears halfway between two real ones. It looks like a way up, but it will break.
```js
const COLORS = { normal: '#16a34a', moving: '#2563eb', breaking: '#a16207' }
// Sometimes a trap halfway to the next platform: it breaks instead of bouncing.
if (Math.random() < 0.15 + 0.25 * d) {
platforms.push({ x: Math.random() * (canvas.width - 60), y: highest + gap / 2, w: 60, h: 12, kind: 'breaking', vx: 0 })
}
```highest + gap / 2 is halfway between the new platform and the one below it, so the traps never block the way.breaking: '#a16207' to COLORS.fillPlatforms, under platforms.push(platform), write the comment and the trap block.Skills: Game states
← Moving platforms It breaks! →