For Challenge: Spaceship Ride in Khan Academy's Advanced JS: Natural Simulations in the computer programming category in the computing course, I need to speed the ships up, turn them upside down, and spin those ships around. this is the default code: angleMode = "radians";
var Spaceship = function() {
this.angle = new PVector();
this.velocity = new PVector(random(-0.01, 0.01), random(-0.01, 0.01));
this.amplitude = new PVector(random(20, width/2), random(20, width/2));
this.position = new PVector(0, 0);
};
Spaceship.prototype.oscillate = function() {
this.angle.add(this.velocity);
this.position.set(
sin(this.angle.x) * this.amplitude.x,
sin(this.angle.y) * this.amplitude.y);
};
Spaceship.prototype.display = function() {
pushMatrix();
translate(width/2, height/2);
stroke(181, 63, 0);
strokeWeight(9);
line(0, 0, this.position.x, this.position.y);
imageMode(CENTER);
image(getImage("space/octopus"),
this.position.x, this.position.y,
80, 100);
popMatrix();
};
var ships = [];
for (var i = 0; i < 10; i++) {
ships.push(new Spaceship());
}
draw = function() {
background(174, 218, 232);
for (var i = 0; i < ships.length; i++) {
ships[i].oscillate();
ships[i].display();
}
};
Can you please tell me what I need to change or add?