Fanning gun out in front
This commit is contained in:
@@ -88,7 +88,7 @@ function draw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Spawn green orb periodically
|
// Spawn green orb periodically
|
||||||
if (millis() - lastGreenSpawn > 0 && !greenOrb) {
|
if (millis() - lastGreenSpawn > 20000 && !greenOrb) {
|
||||||
greenOrb = new GreenOrb();
|
greenOrb = new GreenOrb();
|
||||||
lastGreenSpawn = millis();
|
lastGreenSpawn = millis();
|
||||||
}
|
}
|
||||||
@@ -232,12 +232,12 @@ function keyPressed() {
|
|||||||
if (ship.quadShotActive) {
|
if (ship.quadShotActive) {
|
||||||
// Fire in four directions: forward, backward, left, right
|
// Fire in four directions: forward, backward, left, right
|
||||||
gun_count = 4
|
gun_count = 4
|
||||||
circle_radians = 2.0 * Math.PI
|
shooting_fan_angle = Math.PI / 4.0
|
||||||
angle_between = circle_radians / gun_count
|
angle_between = shooting_fan_angle / gun_count
|
||||||
|
|
||||||
for (let gun_index = 0; gun_index < gun_count; gun_index++) {
|
for (let gun_index = 0; gun_index < gun_count; gun_index++) {
|
||||||
gun_angle = gun_index * angle_between
|
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 {
|
} else {
|
||||||
bullets.push(new Bullet(ship.pos, ship.heading));
|
bullets.push(new Bullet(ship.pos, ship.heading));
|
||||||
|
Reference in New Issue
Block a user