Fanning gun out in front
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user