Now with kids mode
This commit is contained in:
@@ -10,8 +10,9 @@ class Asteroid {
|
||||
this.pos = createVector(random(width), random(height));
|
||||
}
|
||||
}
|
||||
this.vel = p5.Vector.random2D();
|
||||
this.vel.mult(random(1, 3));
|
||||
this.baseVel = p5.Vector.random2D();
|
||||
this.speed = window.kidMode ? random(0.2, 1.5) : random(1, 3);
|
||||
this.vel = this.baseVel.copy().mult(this.speed);
|
||||
this.total = floor(random(5, 15));
|
||||
this.offset = [];
|
||||
for (let i = 0; i < this.total; i++) {
|
||||
@@ -19,10 +20,12 @@ class Asteroid {
|
||||
}
|
||||
this.isGolden = isGolden;
|
||||
this.hitsLeft = isGolden ? 3 : 1;
|
||||
console.log(`Spawned asteroid, isGolden: ${isGolden}, hitsLeft: ${this.hitsLeft}`);
|
||||
console.log(`Spawned asteroid, isGolden: ${isGolden}, hitsLeft: ${this.hitsLeft}, speed: ${this.speed}`);
|
||||
}
|
||||
|
||||
update() {
|
||||
this.speed = window.kidMode ? random(0.2, 1.5) : random(1, 3);
|
||||
this.vel = this.baseVel.copy().mult(this.speed);
|
||||
this.pos.add(this.vel);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user