Workshop › Missile Command-style Defense › Step 32 of 35
From wave 3, one missile in four is marked to split. Here we only set the mark; the splitting comes next.
```js
let incoming // enemy missiles: { sx, sy, x, y, tx, ty, speed, split }
const split = wave >= 3 && Math.random() < 0.25
incoming.push({ sx, sy, x: sx, y: sy, tx, ty: GROUND, speed: 0.5 + wave * 0.15, split })
```wave >= 3 && Math.random() < 0.25 is true from wave 3, one time in four on average.split is stored in the missile ({ split } is split: split). The comment lists the new field., split to the field list in the let incoming comment.launch, under the const tx line, write the split line., split at the end of the object in the push line.Skills: Game states
← Launch from anywhere Split into three →