Workshop › Asteroids › Step 19 of 41
A perfect polygon looks like a bubble, not a rock. Put each corner at a slightly random distance, 0.75 to 1.1 of the radius. The random numbers are chosen once, when the rock is made, and kept.
```js
// A jagged outline: 10 corners at slightly random distances from the center.
const shape = Array.from({ length: 10 }, () => 0.75 + Math.random() * 0.35)
```0.75 + Math.random() * 0.35 is a random number from 0.75 to 1.1, one for each corner.drawAsteroid already multiplies the radius by scale, so nothing else changes.In makeAsteroid, write the comment and change () => 1 to () => 0.75 + Math.random() * 0.35.
Skills: Drawing on a canvas
← Drawing the rocks Drifting rocks →