diff --git a/index.html b/index.html index 707302d..4528b2a 100644 --- a/index.html +++ b/index.html @@ -2,11 +2,10 @@ - - Bastion App + Bastion: The Watcher's Lament diff --git a/public/assets/missions/04_crossroads.json b/public/assets/missions/04_crossroads.json index 75f356f..8ec1145 100644 --- a/public/assets/missions/04_crossroads.json +++ b/public/assets/missions/04_crossroads.json @@ -28,101 +28,79 @@ ], "paths": [ [ - [0, 4], - [1, 4], - [2, 4], - [3, 4], - [4, 4], - [5, 4], - [6, 4], - [7, 4], - [8, 4], - [9, 4], - [10, 4], - [11, 4], - [12, 4], - [13, 4], - [14, 4], - [15, 4], - [16, 4], - [16, 5], - [16, 6], - [16, 7], - [16, 8], - [16, 9], - [16, 10], - [16, 11], - [16, 12], - [16, 13], - [16, 14], - [16, 15], - [16, 16], - [16, 17], - [16, 18], - [16, 19], - [16, 20], - [16, 21], - [16, 22], - [16, 23], - [16, 24] - ], - [ - [4, 0], - [4, 1], - [4, 2], - [4, 3], - [4, 4], - [4, 5], - [4, 6], - [4, 7], - [4, 8], - [4, 9], - [4, 10], - [4, 11], - [4, 12], + [0, 13], + [1, 13], + [2, 13], + [3, 13], [4, 13], - [4, 14], - [4, 15], - [4, 16], - [4, 17], - [4, 18], - [4, 19], - [4, 20], - [4, 21], - [4, 22], - [4, 23], - [4, 24] + [5, 13], + [6, 13], + [7, 13], + [8, 13], + [9, 13], + [10, 13], + [11, 13], + [12, 13], + [13, 13], + [14, 13], + [15, 13], + [15, 12], + [15, 11], + [15, 10], + [16, 10], + [17, 10], + [18, 10], + [19, 10], + [20, 10], + [20, 9], + [20, 8], + [20, 7], + [20, 6], + [21, 6], + [22, 6], + [23, 6], + [24, 6] ], [ - [0, 12], - [1, 12], - [2, 12], - [3, 12], - [4, 12], - [5, 12], - [6, 12], - [7, 12], - [8, 12], - [9, 12], - [10, 12], - [11, 12], - [12, 12], - [13, 12], - [14, 12], - [15, 12], - [16, 12], - [16, 13], - [16, 14], - [16, 15], - [16, 16], - [16, 17], - [16, 18], - [16, 19], - [16, 20], - [16, 21], - [16, 22], - [16, 23], - [16, 24] + [14, 0], + [14, 1], + [14, 2], + [13, 2], + [12, 2], + [11, 2], + [10, 2], + [9, 2], + [8, 2], + [7, 2], + [7, 3], + [7, 4], + [7, 5], + [8, 5], + [9, 5], + [10, 5], + [11, 5], + [12, 5], + [12, 6], + [12, 7], + [12, 8], + [12, 9], + [12, 10], + [13, 10], + [14, 10], + [15, 10], + [16, 10], + [17, 10], + [18, 10], + [19, 10], + [20, 10], + [20, 9], + [20, 8], + [20, 7], + [20, 6], + [21, 6], + [22, 6], + [23, 6], + [24, 6] ] ] }, @@ -140,7 +118,7 @@ "creeps": [1, 1, 2, 1, 1] } ], - "offeredGems": [0, 1, 2] + "offeredGems": [0, 1, 2, 0] }, { "waves": [ diff --git a/public/assets/missions/05_the_maze.json b/public/assets/missions/05_the_maze.json index 7db8bb5..45e1ce9 100644 --- a/public/assets/missions/05_the_maze.json +++ b/public/assets/missions/05_the_maze.json @@ -28,97 +28,158 @@ ], "paths": [ [ - [0, 3], - [1, 3], - [2, 3], - [3, 3], - [4, 3], - [4, 4], - [4, 5], - [4, 6], - [4, 7], - [4, 8], - [4, 9], - [4, 10], - [4, 11], - [4, 12], - [5, 12], - [6, 12], - [7, 12], - [8, 12], - [8, 13], - [8, 14], - [8, 15], - [8, 16], - [8, 17], - [8, 18], - [8, 19], - [8, 20], - [8, 21], - [8, 22], - [8, 23], - [8, 24] - ], - [ - [0, 8], - [1, 8], - [2, 8], - [3, 8], - [4, 8], - [5, 8], - [6, 8], - [7, 8], - [8, 8], - [9, 8], - [10, 8], - [11, 8], - [12, 8], - [12, 9], - [12, 10], - [12, 11], - [12, 12], - [12, 13], + [0, 1], + [1, 1], + [2, 1], + [3, 1], + [4, 1], + [5, 1], + [6, 1], + [7, 1], + [8, 1], + [9, 1], + [10, 1], + [11, 1], + [12, 1], + [13, 1], + [14, 1], + [15, 1], + [16, 1], + [17, 1], + [17, 2], + [17, 3], + [17, 4], + [17, 5], + [17, 6], + [17, 7], + [17, 8], + [17, 9], + [17, 10], + [17, 11], + [17, 12], + [17, 13], + [17, 14], + [16, 14], + [15, 14], + [14, 14], + [13, 14], [12, 14], - [12, 15], - [12, 16], - [12, 17], - [12, 18], - [12, 19], - [12, 20], - [12, 21], - [12, 22], - [12, 23], - [12, 24] + [11, 14], + [10, 14], + [9, 14], + [8, 14], + [7, 14], + [6, 14], + [5, 14], + [5, 13], + [5, 12], + [5, 11], + [5, 10], + [5, 9], + [6, 9], + [7, 9], + [8, 9], + [9, 9], + [10, 9], + [10, 10], + [10, 11], + [11, 11], + [12, 11], + [13, 11], + [14, 11], + [14, 10], + [14, 9], + [14, 8], + [14, 7], + [15, 7], + [16, 7], + [17, 7], + [18, 7], + [19, 7], + [20, 7], + [21, 7], + [22, 7], + [22, 8], + [23, 8], + [24, 8] ], [ - [0, 13], - [1, 13], + [0, 15], + [1, 15], + [2, 15], + [2, 14], [2, 13], - [3, 13], - [4, 13], - [4, 14], - [4, 15], - [4, 16], - [4, 17], - [4, 18], - [4, 19], - [4, 20], - [5, 20], - [6, 20], - [7, 20], - [8, 20], - [9, 20], - [10, 20], - [11, 20], - [12, 20], - [13, 20], - [14, 20], - [15, 20], - [16, 20], - [16, 21], - [16, 22], - [16, 23], - [16, 24] + [2, 12], + [2, 11], + [2, 10], + [2, 9], + [2, 8], + [2, 7], + [2, 6], + [2, 5], + [2, 4], + [3, 4], + [4, 4], + [5, 4], + [6, 4], + [7, 4], + [8, 4], + [9, 4], + [10, 4], + [11, 4], + [12, 4], + [13, 4], + [14, 4], + [14, 5], + [14, 6], + [14, 7], + [14, 8], + [14, 9], + [14, 10], + [14, 11], + [13, 11], + [12, 11], + [11, 11], + [10, 11], + [10, 10], + [10, 9], + [9, 9], + [8, 9], + [7, 9], + [6, 9], + [5, 9], + [5, 10], + [5, 11], + [5, 12], + [5, 13], + [5, 14], + [6, 14], + [7, 14], + [8, 14], + [9, 14], + [10, 14], + [11, 14], + [12, 14], + [13, 14], + [14, 14], + [15, 14], + [16, 14], + [17, 14], + [17, 13], + [17, 12], + [17, 11], + [17, 10], + [17, 9], + [17, 8], + [17, 7], + [18, 7], + [19, 7], + [20, 7], + [21, 7], + [22, 7], + [22, 8], + [23, 8], + [24, 8] ] ] }, diff --git a/public/assets/missions/06_multiple_fronts.json b/public/assets/missions/06_multiple_fronts.json index 2de19b2..24d7d3e 100644 --- a/public/assets/missions/06_multiple_fronts.json +++ b/public/assets/missions/06_multiple_fronts.json @@ -28,101 +28,79 @@ ], "paths": [ [ - [8, 0], - [8, 1], - [8, 2], - [8, 3], - [8, 4], + [5, 0], + [5, 1], + [5, 2], + [4, 2], + [3, 2], + [2, 2], + [2, 3], + [2, 4], + [2, 5], + [3, 5], + [4, 5], + [5, 5], + [6, 5], + [7, 5], [8, 5], - [8, 6], - [8, 7], - [8, 8], - [7, 8], - [6, 8], - [5, 8], - [4, 8], - [4, 9], - [4, 10], - [4, 11], - [4, 12], - [4, 13], - [4, 14], + [9, 5], + [10, 5], + [11, 5], + [12, 5], + [13, 5], + [13, 4], + [13, 3], + [13, 2], + [14, 2], + [15, 2], + [16, 2], + [17, 2], + [18, 2], + [19, 2], + [20, 2], + [21, 2], + [21, 3], + [21, 4], + [21, 5], + [22, 5], + [23, 5], + [24, 5] + ], + [ + [0, 9], + [1, 9], + [2, 9], + [2, 10], + [2, 11], + [2, 12], + [2, 13], + [2, 14], + [2, 15], + [3, 15], [4, 15], - [4, 16], - [4, 17], - [4, 18], - [4, 19], - [4, 20], - [4, 21], - [4, 22], - [4, 23], - [4, 24] - ], - [ - [8, 0], - [8, 1], - [8, 2], - [8, 3], - [8, 4], - [8, 5], - [8, 6], - [8, 7], - [8, 8], - [9, 8], - [10, 8], - [11, 8], - [12, 8], - [12, 9], - [12, 10], - [12, 11], - [12, 12], + [5, 15], + [6, 15], + [7, 15], + [8, 15], + [9, 15], + [10, 15], + [11, 15], + [11, 14], + [11, 13], [12, 13], - [12, 14], - [12, 15], - [12, 16], - [12, 17], - [12, 18], - [12, 19], - [12, 20], - [12, 21], - [12, 22], - [12, 23], - [12, 24] - ], - [ - [0, 8], - [1, 8], - [2, 8], - [3, 8], - [4, 8], - [5, 8], - [6, 8], - [7, 8], - [8, 8], - [9, 8], - [10, 8], - [11, 8], - [12, 8], - [13, 8], - [14, 8], - [15, 8], - [16, 8], - [16, 9], - [16, 10], - [16, 11], - [16, 12], + [13, 13], + [14, 13], + [15, 13], [16, 13], - [16, 14], - [16, 15], - [16, 16], - [16, 17], - [16, 18], - [16, 19], - [16, 20], - [16, 21], - [16, 22], - [16, 23], - [16, 24] + [17, 13], + [17, 14], + [18, 14], + [19, 14], + [20, 14], + [21, 14], + [22, 14], + [23, 14], + [24, 14] ] ] }, diff --git a/public/assets/missions/07_final_stretch.json b/public/assets/missions/07_final_stretch.json new file mode 100644 index 0000000..3ad9349 --- /dev/null +++ b/public/assets/missions/07_final_stretch.json @@ -0,0 +1,223 @@ +{ + "name": "Final Stretch", + "description": "The final map, the longest map, the 7th map.", + "mapImage": { + "url": "/assets/maps/07_final_stretch.png" + }, + "gameMap": { + "rows": 17, + "columns": 25, + "cells": [ + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] + ], + "paths": [ + [ + [2, 0], + [2, 1], + [2, 2], + [2, 3], + [2, 4], + [2, 5], + [2, 6], + [2, 7], + [2, 8], + [2, 9], + [2, 10], + [2, 11], + [2, 12], + [2, 13], + [2, 14], + [3, 14], + [4, 14], + [5, 14], + [6, 14], + [6, 13], + [6, 12], + [6, 11], + [6, 10], + [6, 9], + [6, 8], + [6, 7], + [6, 6], + [6, 5], + [6, 4], + [6, 3], + [6, 2], + [7, 2], + [8, 2], + [9, 2], + [10, 2], + [10, 3], + [10, 4], + [10, 5], + [10, 6], + [10, 7], + [10, 8], + [10, 9], + [10, 10], + [10, 11], + [10, 12], + [10, 13], + [10, 14], + [11, 14], + [12, 14], + [13, 14], + [14, 14], + [14, 13], + [14, 12], + [14, 11], + [14, 10], + [14, 9], + [14, 8], + [14, 7], + [14, 6], + [14, 5], + [14, 4], + [14, 3], + [14, 2], + [15, 2], + [16, 2], + [17, 2], + [18, 2], + [18, 3], + [18, 4], + [18, 5], + [18, 6], + [18, 7], + [18, 8], + [18, 9], + [18, 10], + [18, 11], + [18, 12], + [18, 13], + [18, 14], + [19, 14], + [20, 14], + [21, 14], + [22, 14], + [22, 13], + [22, 12], + [22, 11], + [22, 10], + [22, 9], + [22, 8], + [22, 7], + [22, 6], + [22, 5], + [22, 4], + [22, 3], + [22, 2], + [22, 1], + [22, 0] + ] + ] + }, + "rounds": [ + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 700, + "creeps": [0, 1, 0, 1, 0, 1, 0] + }, + { + "firstCreepSpawnTick": 5000, + "spawnIntervalTicks": 500, + "creeps": [1, 1, 2, 1, 1, 2, 1] + } + ], + "offeredGems": [0, 1, 2, 3] + }, + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 600, + "creeps": [2, 1, 2, 1, 2, 1, 2, 1] + }, + { + "firstCreepSpawnTick": 6000, + "spawnIntervalTicks": 400, + "creeps": [2, 2, 1, 1, 2, 2, 1, 1] + } + ], + "offeredGems": [0, 1, 2, 3] + }, + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 500, + "creeps": [2, 2, 1, 1, 2, 2, 1, 1, 2] + }, + { + "firstCreepSpawnTick": 6000, + "spawnIntervalTicks": 300, + "creeps": [2, 2, 2, 1, 1, 1, 2, 2, 2] + } + ], + "offeredGems": [0, 1, 2, 3] + }, + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 400, + "creeps": [2, 2, 2, 1, 1, 1, 2, 2, 2, 1] + }, + { + "firstCreepSpawnTick": 7000, + "spawnIntervalTicks": 250, + "creeps": [2, 2, 2, 2, 1, 1, 1, 1, 2, 2] + } + ], + "offeredGems": [0, 1, 2, 3] + }, + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 300, + "creeps": [2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2] + }, + { + "firstCreepSpawnTick": 7000, + "spawnIntervalTicks": 200, + "creeps": [2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2] + } + ], + "offeredGems": [0, 1, 2, 3] + }, + { + "waves": [ + { + "firstCreepSpawnTick": 500, + "spawnIntervalTicks": 250, + "creeps": [2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 2] + }, + { + "firstCreepSpawnTick": 8000, + "spawnIntervalTicks": 150, + "creeps": [2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1] + } + ], + "offeredGems": [0, 1, 2, 3] + } + ] +} diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..c4cfea9 Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/favicon.png b/public/favicon.png new file mode 100644 index 0000000..8f8ebc9 Binary files /dev/null and b/public/favicon.png differ diff --git a/src/classes/Assets.ts b/src/classes/Assets.ts index c25519b..33ada65 100644 --- a/src/classes/Assets.ts +++ b/src/classes/Assets.ts @@ -158,6 +158,7 @@ export default class GameAssets { await this.LoadMission('./assets/missions/04_crossroads.json'); await this.LoadMission('./assets/missions/05_the_maze.json'); await this.LoadMission('./assets/missions/06_multiple_fronts.json'); + await this.LoadMission('./assets/missions/07_final_stretch.json'); } private static async LoadTowers() { diff --git a/src/classes/Bastion.ts b/src/classes/Bastion.ts index b8fc872..179cf49 100644 --- a/src/classes/Bastion.ts +++ b/src/classes/Bastion.ts @@ -22,6 +22,7 @@ export class Engine { public static NotificationManager: NotificationManager; public static GameScene: GameScene; public static latestCommit: string; + public static latestGemId = 0; public static GridCellSize: number = 64; public static GridColumns: number = 25; diff --git a/src/classes/game/Gem.ts b/src/classes/game/Gem.ts index b699dbc..8f0bc07 100644 --- a/src/classes/game/Gem.ts +++ b/src/classes/game/Gem.ts @@ -1,8 +1,7 @@ import * as PIXI from 'pixi.js'; import { GemType, GemDefinition, GenericGemImprovement } from '../Definitions'; import GameAssets from '../Assets'; - -let latestGemId = 0; +import { Engine } from '../Bastion'; export default class Gem { public texture: PIXI.Texture; @@ -14,8 +13,8 @@ export default class Gem { this.texture = this.definition.textures[0]; if (!doNotIncrement) { - this.id = latestGemId + 1; - latestGemId++; + this.id = Engine.latestGemId + 1; + Engine.latestGemId++; } else this.id = ''; } public currentGemImprovement() { diff --git a/src/classes/game/Grid.ts b/src/classes/game/Grid.ts index dd3c1a4..3416bb0 100644 --- a/src/classes/game/Grid.ts +++ b/src/classes/game/Grid.ts @@ -6,6 +6,8 @@ import { Engine } from '../Bastion'; import Creep from './Creep'; import { CreepEvents, TowerEvents, GridEvents } from '../Events'; +let genPath = []; + export class Cell extends GameObject { public type: TerrainType; public row: number; @@ -55,6 +57,7 @@ export class Cell extends GameObject { Engine.GameScene.events.emit(GridEvents.CellMouseLeave, this); Engine.Grid.rangePreview.clear(); }); + Engine.GameScene.events.on(TowerEvents.TowerPlacedEvent, (_, row, col) => { if (row == this.row && col == this.column) { this.hasTowerPlaced = true; @@ -68,11 +71,13 @@ export class Cell extends GameObject { }); // Disable this if you want to add new maps. - // if(true) return; + if (true) return; + const text = new PIXI.Text({ text: `${this.column}|${this.row}`, style: new PIXI.TextStyle({ fill: 0xffffff, + fontSize: 16, stroke: { color: 0x000000, width: 2, @@ -87,6 +92,18 @@ export class Cell extends GameObject { text.style.fill = 'pink'; text.style.fontWeight = 'bold'; } + this.clickDetector.on('pointerup', () => { + const cellIndex = genPath.findIndex(([col, row]) => col === this.column && row === this.row); + if (cellIndex !== -1) { + text.style.fill = 0xffffff; + genPath.splice(cellIndex, 1); + } else { + text.style.fill = 0xff0000; + genPath.push([this.column, this.row]); + } + console.log('updated gen path'); + console.log(JSON.stringify(genPath)); + }); } public showRangePreview(invalid, range) { let color = 0xffffff; diff --git a/src/classes/game/NotificationManager.ts b/src/classes/game/NotificationManager.ts index 737be4e..547155b 100644 --- a/src/classes/game/NotificationManager.ts +++ b/src/classes/game/NotificationManager.ts @@ -3,7 +3,7 @@ import GameObject from '../GameObject'; import * as PIXI from 'pixi.js'; import { FadeInOut } from './AnimationManager'; -export type NotificationType = 'info' | 'warn' | 'danger' | 'reward' | 'gemaward'; +export type NotificationType = 'info' | 'warn' | 'danger' | 'reward' | 'gemaward' | 'green'; class Notification { public textObj: PIXI.Text; @@ -22,6 +22,8 @@ class Notification { fill = 0xd65afc; } else if (type == 'gemaward') { fill = 0xffffff; + } else if (type == 'green') { + fill = 0x00ff00; } this.ticksToFadeAway = ticksToFadeAway; this.textObj = new PIXI.Text({ diff --git a/src/classes/game/WaveManager.ts b/src/classes/game/WaveManager.ts index 0adbf9d..4c73a1e 100644 --- a/src/classes/game/WaveManager.ts +++ b/src/classes/game/WaveManager.ts @@ -17,31 +17,38 @@ export default class WaveManager extends GameObject { private paths: PathDefinition[]; private ticks: number = 0; private started: boolean = false; - public finished: boolean = false; private internalCreepId: number = 0; + private pathsIndex: number; + public finished: boolean = false; + constructor(rounds: MissionRoundDefinition[], paths: PathDefinition[]) { super(); Engine.WaveManager = this; this.rounds = rounds; this.paths = paths; + this.pathsIndex = 0; } public start(roundIndex) { this.started = true; this.ticks = 0; this.creeps = []; this.finished = false; + if (this.pathsIndex + 1 == this.paths.length) { + this.pathsIndex = 0; + } else { + this.pathsIndex++; + } let tickToSpawnAt = 0; this.rounds[roundIndex].waves.forEach((wave) => { tickToSpawnAt += wave.firstCreepSpawnTick; wave.creeps.forEach((creep) => { - const creepObj = new Creep(creep, this.paths[0], this.internalCreepId); + const creepObj = new Creep(creep, this.paths[this.pathsIndex], this.internalCreepId); this.internalCreepId++; const creepInstance = { creep: creepObj, tickToSpawnAt, spawned: false, }; - console.log('CREAWTASEDASD'); tickToSpawnAt += wave.spawnIntervalTicks; this.creeps.push(creepInstance); }); @@ -58,10 +65,8 @@ export default class WaveManager extends GameObject { if (!creep.spawned && creep.tickToSpawnAt <= this.ticks) { creep.spawned = true; this.events.emit(WaveManagerEvents.CreepSpawned, creep.creep); - console.log('Wave manager creep spawned, ', creep, this.ticks); if (!this.finished && this.creeps.every((creep) => creep.spawned)) { this.finished = true; - console.log('wave manager finished'); this.events.emit(WaveManagerEvents.Finished); } } else if (creep.spawned) { diff --git a/src/main.ts b/src/main.ts index dcb047e..6311fad 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,8 +6,8 @@ import { GameScene } from './scenes/Game'; import { AnimationManager } from './classes/game/AnimationManager'; import NotificationManager from './classes/game/NotificationManager'; import GameUIConstants from './classes/GameUIConstants'; -import MessageBox from './classes/gui/MessageBox'; import KeyboardManager from './classes/game/KeyboardManager'; +import { GemType } from './classes/Definitions'; (async () => { const app = new PIXI.Application(); diff --git a/src/scenes/Game.ts b/src/scenes/Game.ts index 3ad74e3..8ed5ebf 100644 --- a/src/scenes/Game.ts +++ b/src/scenes/Game.ts @@ -59,6 +59,7 @@ export class GameScene extends Scene { }); } public init() { + Engine.latestGemId = 0; new Grid(this.mission.gameMap, this.missionIndex); new TowerManager(); new WaveManager(this.mission.rounds, this.mission.gameMap.paths); @@ -257,10 +258,14 @@ export class GameScene extends Scene { this.ReturnToMain(); } else if (result === HighScoreDialogButtons.NextMission) { this.destroy(); + Engine.GameMaster.changeScene(new MissionPickerScene()); Engine.GameMaster.changeScene(new GameScene(GameAssets.Missions[this.missionIndex + 1].name)); + Engine.NotificationManager.Notify('Loading next mission. Good luck.', 'green'); } else if (result === HighScoreDialogButtons.Retry) { this.destroy(); + Engine.GameMaster.changeScene(new MissionPickerScene()); Engine.GameMaster.changeScene(new GameScene(this.mission.name)); + Engine.NotificationManager.Notify('Retrying mission.', 'green'); } } diff --git a/src/scenes/Scene.ts b/src/scenes/Scene.ts index 0e2d9d6..0686908 100644 --- a/src/scenes/Scene.ts +++ b/src/scenes/Scene.ts @@ -12,6 +12,7 @@ export default class Scene { } public destroy() { this.stage.destroy(); + this._events.removeAllListeners(); this.gui.forEach((element) => { element.destroy(); });