From 5cd6b55a65a0b94875472d5569fdffaa09d3d4e5 Mon Sep 17 00:00:00 2001 From: Paul Hebert Date: Sun, 1 Jan 2023 14:48:04 -0500 Subject: [PATCH] Fix levels to use new ships --- fresh-eyed-thoughts.md | 4 + scripts/actions/add-random-ship.js | 18 --- scripts/levels/debug.js | 4 +- scripts/levels/level3.js | 2 +- scripts/levels/level4.js | 13 +- scripts/levels/level5.js | 11 +- scripts/levels/levels.js | 140 +++++++++--------- scripts/levels/types/fight.js | 22 ++- .../ships/{ => archetypes/gunship}/falcon.js | 10 +- .../ships/archetypes/small-fighter/sprayer.js | 19 +++ .../transport}/mining-overseer.js | 4 +- scripts/ships/big.js | 23 --- scripts/ships/crow.js | 15 -- scripts/ships/mother-ship.js | 26 ---- scripts/ships/sparrow.js | 14 -- scripts/ships/sprayer.js | 26 ---- 16 files changed, 129 insertions(+), 222 deletions(-) create mode 100644 fresh-eyed-thoughts.md delete mode 100644 scripts/actions/add-random-ship.js rename scripts/ships/{ => archetypes/gunship}/falcon.js (51%) create mode 100644 scripts/ships/archetypes/small-fighter/sprayer.js rename scripts/ships/{ => archetypes/transport}/mining-overseer.js (70%) delete mode 100644 scripts/ships/big.js delete mode 100644 scripts/ships/crow.js delete mode 100644 scripts/ships/mother-ship.js delete mode 100644 scripts/ships/sparrow.js delete mode 100644 scripts/ships/sprayer.js diff --git a/fresh-eyed-thoughts.md b/fresh-eyed-thoughts.md new file mode 100644 index 0000000..2c0a5b6 --- /dev/null +++ b/fresh-eyed-thoughts.md @@ -0,0 +1,4 @@ +- Everything feels fast. Should everything move slower? +- Weapon upgrades/messages get missed. Reduce number of messages? Make things more obvious? +- Should there be some loss of inertia/friction/decelleration? +- It would be easier to improve levels if their file names matched their names, where possible diff --git a/scripts/actions/add-random-ship.js b/scripts/actions/add-random-ship.js deleted file mode 100644 index a078833..0000000 --- a/scripts/actions/add-random-ship.js +++ /dev/null @@ -1,18 +0,0 @@ -import { BaseShip } from "../ships/base.js"; -import { BigShip } from "../ships/big.js"; -import { ScoutShip } from "../ships/archetypes/scout/scout.js"; -import { playerState } from "../state/player-state.js"; -import { randomBool, randomItemInArray } from "../math/random.js"; -import { mapSize } from "../map-size.js"; -import { mapData } from "../state/map-data.js"; - -export function addRandomShip() { - const pos = { - x: playerState.x + mapSize * (randomBool(0.5) ? 1 : -1), - y: playerState.y + mapSize * (randomBool(0.5) ? 1 : -1), - }; - - const shipOptions = [new BaseShip(pos), new BigShip(pos), new ScoutShip(pos)]; - - mapData.ships.push(randomItemInArray(shipOptions)); -} diff --git a/scripts/levels/debug.js b/scripts/levels/debug.js index e0c7c14..183f903 100644 --- a/scripts/levels/debug.js +++ b/scripts/levels/debug.js @@ -23,8 +23,8 @@ import { Boom } from "../weapons/boom.js"; import { updateWeapons } from "../hud/update-weapons.js"; import { showShieldBar } from "../hud/update-shield-bar.js"; import { random } from "../math/random.js"; -import { MiningOverseer } from "../ships/mining-overseer.js"; -import { FalconShip } from "../ships/falcon.js"; +import { MiningOverseer } from "../ships/archetypes/transport/mining-overseer.js"; +import { FalconShip } from "../ships/archetypes/gunship/falcon.js"; import { Commander } from "../ships/archetypes/commander/commander.js"; import { Pew } from "../weapons/pew.js"; import { StasisLaser } from "../weapons/stasis-laser.js"; diff --git a/scripts/levels/level3.js b/scripts/levels/level3.js index f9cffb0..172c1c5 100644 --- a/scripts/levels/level3.js +++ b/scripts/levels/level3.js @@ -8,7 +8,7 @@ import { positionToMapBottom, } from "../math/position-to-map-edge.js"; import { Transport } from "../ships/archetypes/transport/transport.js"; -import { MiningOverseer } from "../ships/mining-overseer.js"; +import { MiningOverseer } from "../ships/archetypes/transport/mining-overseer.js"; import { battleObjective } from "./objectives/battle.js"; export function level3() { diff --git a/scripts/levels/level4.js b/scripts/levels/level4.js index 1b4fb6f..d5374e6 100644 --- a/scripts/levels/level4.js +++ b/scripts/levels/level4.js @@ -1,9 +1,7 @@ import { addMessageToQueue } from "../hud/messaging.js"; -import { SparrowShip } from "../ships/sparrow.js"; import { mapData } from "../state/map-data.js"; import { ScoutShip } from "../ships/archetypes/scout/scout.js"; import { HunterShip } from "../ships/archetypes/hunter/hunter.js"; -import { BigShip } from "../ships/big.js"; import { completeLevel } from "./levels.js"; import { positionToMapBottom, @@ -12,10 +10,15 @@ import { positionToMapTop, } from "../math/position-to-map-edge.js"; import { battleObjective } from "./objectives/battle.js"; +import { ArtilleryShip } from "../ships/archetypes/artillery/artillery.js"; +import { SmallFighterShip } from "../ships/archetypes/small-fighter/small-fighter.js"; export function level4() { - for (let i = 0; i < 3; i++) { - mapData.ships.push(new SparrowShip(positionToMapBottom())); + for (let i = 0; i < 5; i++) { + mapData.ships.push(new SmallFighterShip(positionToMapBottom())); + } + for (let i = 0; i < 5; i++) { + mapData.ships.push(new SmallFighterShip(positionToMapTop())); } for (let i = 0; i < 10; i++) { @@ -24,7 +27,7 @@ export function level4() { mapData.ships.push(new HunterShip(positionToMapTop())); - mapData.ships.push(new BigShip(positionToMapRight())); + mapData.ships.push(new ArtilleryShip(positionToMapRight())); addMessageToQueue({ content: ` diff --git a/scripts/levels/level5.js b/scripts/levels/level5.js index 8ea1f88..8170cc9 100644 --- a/scripts/levels/level5.js +++ b/scripts/levels/level5.js @@ -1,9 +1,5 @@ import { addMessageToQueue } from "../hud/messaging.js"; -import { SparrowShip } from "../ships/sparrow.js"; import { mapData } from "../state/map-data.js"; -import { ScoutShip } from "../ships/archetypes/scout/scout.js"; -import { HunterShip } from "../ships/archetypes/hunter/hunter.js"; -import { BigShip } from "../ships/big.js"; import { completeLevel } from "./levels.js"; import { positionToMapBottom, @@ -12,9 +8,10 @@ import { positionToMapTop, } from "../math/position-to-map-edge.js"; import { Transport } from "../ships/archetypes/transport/transport.js"; -import { MiningOverseer } from "../ships/mining-overseer.js"; +import { MiningOverseer } from "../ships/archetypes/transport/mining-overseer.js"; import { battleObjective } from "./objectives/battle.js"; -import { FalconShip } from "../ships/falcon.js"; +import { FalconShip } from "../ships/archetypes/gunship/falcon.js"; +import { Commander } from "../ships/archetypes/commander/commander.js"; export function level5() { for (let i = 0; i < 2; i++) { @@ -23,7 +20,7 @@ export function level5() { } mapData.ships.push(new FalconShip(positionToMapTop())); - mapData.ships.push(new FalconShip(positionToMapBottom())); + mapData.ships.push(new Commander(positionToMapBottom())); addMessageToQueue({ content: ` diff --git a/scripts/levels/levels.js b/scripts/levels/levels.js index 31b722b..895e87e 100644 --- a/scripts/levels/levels.js +++ b/scripts/levels/levels.js @@ -60,76 +60,76 @@ export function completeLevel() { } export const levels = [ - // { - // title: "Company Mining Colony", - // action: tutorial, - // }, - // { - // title: "Out of the Frying Pan", - // action: level1, - // }, - // { - // title: "Into the Fire", - // action: () => { - // fightLevel({ difficulty: 10 }); - // }, - // }, - // { - // title: "Caught by the Destroyer", - // action: theDestroyer, - // }, - // { - // title: "Outside New Sol X", - // action: () => { - // fightLevel({ difficulty: 12 }); - // }, - // }, - // { - // title: "Ambushed By Company Drones", - // action: level4, - // }, - // { - // title: "Company Resupply Depot", - // action: () => { - // fightLevel({ difficulty: 16 }); - // }, - // }, - // { - // title: "Company Logistics HQ", - // action: level3, - // }, - // { - // title: "The Edge of the Belt", - // action: () => { - // fightLevel({ difficulty: 25 }); - // }, - // }, - // { - // title: "The Big Empty", - // action: level1, - // }, - // { - // title: "In Hot Pursuit", - // action: () => { - // fightLevel({ difficulty: 50 }); - // }, - // }, - // { - // title: "Almost Home", - // action: level5, - // }, - // { - // title: "The Final Battle", - // action: () => { - // fightLevel({ difficulty: 75 }); - // }, - // }, - // { - // title: "The Overseer", - // action: theOverseer, - // }, { - title: "Secret Debug Level", - action: debugLevel, + title: "Company Mining Colony", + action: tutorial, }, + { + title: "Out of the Frying Pan", + action: level1, + }, + { + title: "Into the Fire", + action: () => { + fightLevel({ difficulty: 10 }); + }, + }, + { + title: "Caught by the Destroyer", + action: theDestroyer, + }, + { + title: "Outside New Sol X", + action: () => { + fightLevel({ difficulty: 12 }); + }, + }, + { + title: "Ambushed By Company Drones", + action: level4, + }, + { + title: "Company Resupply Depot", + action: () => { + fightLevel({ difficulty: 16 }); + }, + }, + { + title: "Company Logistics HQ", + action: level3, + }, + { + title: "The Edge of the Belt", + action: () => { + fightLevel({ difficulty: 25 }); + }, + }, + { + title: "The Big Empty", + action: level1, + }, + { + title: "In Hot Pursuit", + action: () => { + fightLevel({ difficulty: 50 }); + }, + }, + { + title: "Almost Home", + action: level5, + }, + { + title: "The Final Battle", + action: () => { + fightLevel({ difficulty: 75 }); + }, + }, + { + title: "The Overseer", + action: theOverseer, + }, + // { + // title: "Secret Debug Level", + // action: debugLevel, + // }, ]; diff --git a/scripts/levels/types/fight.js b/scripts/levels/types/fight.js index 0765ee8..f9be73e 100644 --- a/scripts/levels/types/fight.js +++ b/scripts/levels/types/fight.js @@ -1,9 +1,6 @@ import { Transport } from "../../ships/archetypes/transport/transport.js"; import { HunterShip } from "../../ships/archetypes/hunter/hunter.js"; -import { CrowShip } from "../../ships/crow.js"; import { ScoutShip } from "../../ships/archetypes/scout/scout.js"; -import { BigShip } from "../../ships/big.js"; -import { SparrowShip } from "../../ships/sparrow.js"; import { randomItemInArray, shuffle } from "../../math/random.js"; import { mapData } from "../../state/map-data.js"; import { positionToRandomMapEdge } from "../../math/position-to-map-edge.js"; @@ -11,22 +8,31 @@ import { addMessageToQueue } from "../../hud/messaging.js"; import { completeLevel } from "../levels.js"; import { PestShip } from "../../ships/archetypes/pest/pest.js"; import { battleObjective } from "../objectives/battle.js"; -import { SprayerShip } from "../../ships/sprayer.js"; -import { FalconShip } from "../../ships/falcon.js"; +import { FalconShip } from "../../ships/archetypes/gunship/falcon.js"; +import { ArmedTransport } from "../../ships/archetypes/armed-transport/armed-transport.js"; +import { ArtilleryShip } from "../../ships/archetypes/artillery/artillery.js"; +import { Commander } from "../../ships/archetypes/commander/commander.js"; +import { GunShip } from "../../ships/archetypes/gunship/gunship.js"; +import { SmallFighterShip } from "../../ships/archetypes/small-fighter/small-fighter.js"; +import { SpaceStation } from "../../ships/archetypes/space-station/space-station.js"; // TODO: Clusters of enemies const enemyOptions = [ { difficulty: 20, - options: [FalconShip], + options: [FalconShip, Commander], + }, + { + difficulty: 15, + options: [ArmedTransport, ArtilleryShip, GunShip], }, { difficulty: 10, - options: [Transport, HunterShip], + options: [Transport, HunterShip, SpaceStation], }, { difficulty: 4, - options: [SprayerShip, SparrowShip, CrowShip], + options: [SmallFighterShip], }, { difficulty: 1, diff --git a/scripts/ships/falcon.js b/scripts/ships/archetypes/gunship/falcon.js similarity index 51% rename from scripts/ships/falcon.js rename to scripts/ships/archetypes/gunship/falcon.js index 527481b..aa9b471 100644 --- a/scripts/ships/falcon.js +++ b/scripts/ships/archetypes/gunship/falcon.js @@ -1,8 +1,8 @@ -import { StasisLaser } from "../weapons/stasis-laser.js"; -import { Laser } from "../weapons/laser.js"; -import { Pew } from "../weapons/pew.js"; -import { Boom } from "../weapons/boom.js"; -import { GunShip } from "./archetypes/gunship/gunship.js"; +import { StasisLaser } from "../../../weapons/stasis-laser.js"; +import { Laser } from "../../../weapons/laser.js"; +import { Pew } from "../../../weapons/pew.js"; +import { Boom } from "../../../weapons/boom.js"; +import { GunShip } from "./gunship.js"; export class FalconShip extends GunShip { size = 150; diff --git a/scripts/ships/archetypes/small-fighter/sprayer.js b/scripts/ships/archetypes/small-fighter/sprayer.js new file mode 100644 index 0000000..25dd3ed --- /dev/null +++ b/scripts/ships/archetypes/small-fighter/sprayer.js @@ -0,0 +1,19 @@ +import { SprayBlaster } from "../../../weapons/spray-blaster.js"; + +export class SmallFighterShip extends SmallFighterShip { + rotationSpeed = 5; + accelerationSpeed = 1; + maxSpeed = 10; + graphic = document.getElementById("ship-3"); + + size = 150; + + maxHealth = 450; + health = 450; + + weapons = [new SprayBlaster()]; + + targetRange = { + min: 0, + }; +} diff --git a/scripts/ships/mining-overseer.js b/scripts/ships/archetypes/transport/mining-overseer.js similarity index 70% rename from scripts/ships/mining-overseer.js rename to scripts/ships/archetypes/transport/mining-overseer.js index d7ea269..f380217 100644 --- a/scripts/ships/mining-overseer.js +++ b/scripts/ships/archetypes/transport/mining-overseer.js @@ -1,5 +1,5 @@ -import { DroneSpawner } from "../weapons/drone-spawner.js"; -import { Transport } from "./archetypes/transport/transport.js"; +import { DroneSpawner } from "../../../weapons/drone-spawner.js"; +import { Transport } from "./transport.js"; export class MiningOverseer extends Transport { graphic = document.getElementById("ship-2"); diff --git a/scripts/ships/big.js b/scripts/ships/big.js deleted file mode 100644 index 9c16ba7..0000000 --- a/scripts/ships/big.js +++ /dev/null @@ -1,23 +0,0 @@ -import { BaseShip } from "./base.js"; -import { Pew } from "../weapons/pew.js"; -import { Laser } from "../weapons/laser.js"; - -export class BigShip extends BaseShip { - accelerationSpeed = 0.125; - rotationSpeed = 1; - - size = 160; - - shields = 200; - maxShields = 200; - - maxHealth = 400; - health = 400; - maxSpeed = 8; - - targetRange = { - min: 400, - }; - - weapons = [new Pew(), new Laser()]; -} diff --git a/scripts/ships/crow.js b/scripts/ships/crow.js deleted file mode 100644 index ce216ad..0000000 --- a/scripts/ships/crow.js +++ /dev/null @@ -1,15 +0,0 @@ -import { BaseShip } from "./base.js"; -import { DoubleGun } from "../weapons/double-gun.js"; - -export class CrowShip extends BaseShip { - size = 150; - - health = 600; - maxHealth = 600; - - maxSpeed = 8; - rotationSpeed = 1; - accelerationSpeed = 0.25; - - weapons = [new DoubleGun()]; -} diff --git a/scripts/ships/mother-ship.js b/scripts/ships/mother-ship.js deleted file mode 100644 index 22c84ec..0000000 --- a/scripts/ships/mother-ship.js +++ /dev/null @@ -1,26 +0,0 @@ -import { BaseShip } from "./base.js"; -import { ShipSpawner } from "../weapons/ship-spawner.js"; - -export class MotherShip extends BaseShip { - graphic = document.getElementById("ship-2"); - - accelerationSpeed = 0.125; - rotationSpeed = 1; - - size = 300; - - maxHealth = 1200; - health = 1200; - maxSpeed = 6; - maxResourceCount = 5; - - upgradeDropChance = 0.5; - upgradeIsWeaponChance = 0; - - weapons = [new ShipSpawner()]; - - targetRange = { - min: 600, - ideal: 800, - }; -} diff --git a/scripts/ships/sparrow.js b/scripts/ships/sparrow.js deleted file mode 100644 index 30fbc3f..0000000 --- a/scripts/ships/sparrow.js +++ /dev/null @@ -1,14 +0,0 @@ -import { BaseShip } from "./base.js"; -import { Ray } from "../weapons/ray.js"; - -export class SparrowShip extends BaseShip { - graphic = document.getElementById("sparrow"); - - size = 100; - - maxHealth = 200; - health = 200; - maxSpeed = 8; - - weapons = [new Ray()]; -} diff --git a/scripts/ships/sprayer.js b/scripts/ships/sprayer.js deleted file mode 100644 index 16e774e..0000000 --- a/scripts/ships/sprayer.js +++ /dev/null @@ -1,26 +0,0 @@ -import { BaseShip } from "./base.js"; -import { randomInt } from "../math/random.js"; -import { SprayBlaster } from "../weapons/spray-blaster.js"; - -export class SprayerShip extends BaseShip { - constructor(params) { - super(params); - this.currentGun = randomInt(0, this.weapons.length - 1); - } - - rotationSpeed = 5; - accelerationSpeed = 1; - maxSpeed = 15; - graphic = document.getElementById("ship-3"); - - size = 100; - - maxHealth = 200; - health = 200; - - maxResourceCount = 2; - - weapons = [new SprayBlaster()]; - - targetRange = { min: 0 }; -}