Now with kids mode

This commit is contained in:
Eric Ratliff
2025-06-25 23:28:10 -05:00
parent 681feab148
commit a569e6b7d2
5 changed files with 109 additions and 57 deletions

View File

@@ -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);
}