Fanning gun out in front

This commit is contained in:
Eric Ratliff
2025-06-26 09:35:00 -05:00
parent f4416ac078
commit 1f3463225e

View File

@@ -88,7 +88,7 @@ function draw() {
}
// Spawn green orb periodically
if (millis() - lastGreenSpawn > 0 && !greenOrb) {
if (millis() - lastGreenSpawn > 20000 && !greenOrb) {
greenOrb = new GreenOrb();
lastGreenSpawn = millis();
}
@@ -232,12 +232,12 @@ function keyPressed() {
if (ship.quadShotActive) {
// Fire in four directions: forward, backward, left, right
gun_count = 4
circle_radians = 2.0 * Math.PI
angle_between = circle_radians / gun_count
shooting_fan_angle = Math.PI / 4.0
angle_between = shooting_fan_angle / gun_count
for (let gun_index = 0; gun_index < gun_count; gun_index++) {
gun_angle = gun_index * angle_between
bullets.push(new Bullet(ship.pos, ship.heading + gun_angle));
bullets.push(new Bullet(ship.pos, ship.heading + gun_angle - (shooting_fan_angle/2.0)));
}
} else {
bullets.push(new Bullet(ship.pos, ship.heading));