asteroids

Next I would like to make some asteroids that can float around the screen.

First I will create a variable and assign it to an array:

let asteroids = [];

Then I will create a function that will be called to create an asteroid:

createAsteroid();

Now I will set up that function. I will clear the asteroids.

createAsteroid() {

}

Now I will create a function for a new asteroid:

function newAsteroid(x, y) {
    let asteroid = {
    x: x,
    y: y,
    xv: Math.random() * ASTEROIDS_SPEED / FPS * (Math.random() < 0.5 ? 1 : -1),
    yv: Math.random() * ASTEROIDS_SPEED / FPS * (Math.random() < 0.5 ? 1 : -1),
    r: ROIDS_SIZE / 2;
    a: Math.random() * Math.PI * 2
}
}