Workshop › Asteroids › Step 27 of 41
If any rock touches the ship, it crashes. The ship counts as a circle a bit smaller than it is (SHIP_R * 0.7): a
triangle does not fill its circle, and a forgiving hitbox feels fair.
```js
if (asteroids.some((asteroid) => hits(ship, SHIP_R * 0.7, asteroid, asteroid.r))) {
crash()
return
}
```some is true if at least one rock hits the ship.return leaves update for this frame.In update, under the filter line, leave an empty line and write the if block.
Skills: Collision detection
← Losing a life Show the lives →