diff --git a/assets/basic-enemies.png b/assets/basic-enemies.png index 31d199c..e0db7a8 100644 Binary files a/assets/basic-enemies.png and b/assets/basic-enemies.png differ diff --git a/assets/basic-enemies.psd b/assets/basic-enemies.psd index 902f047..72b6bb4 100644 Binary files a/assets/basic-enemies.psd and b/assets/basic-enemies.psd differ diff --git a/src/levels/level.js b/src/levels/level.js index ec4dabf..faa9ba4 100644 --- a/src/levels/level.js +++ b/src/levels/level.js @@ -57,23 +57,23 @@ export class Level extends Phaser.Scene { } addControls() { - // this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => { - // const zoomSpeed = 0.1; - // if (deltaY < 0) { - // // Zoom in - // this.cameras.main.zoom += zoomSpeed; - // } else if (deltaY > 0) { - // // Zoom out - // this.cameras.main.zoom -= zoomSpeed; - // } + this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => { + const zoomSpeed = 0.1; + if (deltaY < 0) { + // Zoom in + this.cameras.main.zoom += zoomSpeed; + } else if (deltaY > 0) { + // Zoom out + this.cameras.main.zoom -= zoomSpeed; + } - // // Limit zoom range to prevent extreme zoom levels - // this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2); + // Limit zoom range to prevent extreme zoom levels + this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2); - // // Zoom toward mouse position - // const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main); - // this.cameras.main.centerOn(worldPoint.x, worldPoint.y); - // }); + // Zoom toward mouse position + const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main); + this.cameras.main.centerOn(worldPoint.x, worldPoint.y); + }); // Add camera panning functionality this.input.on('pointerdown', (pointer) => { diff --git a/src/support/enemies.js b/src/support/enemies.js index cfbeaa1..6df558f 100644 --- a/src/support/enemies.js +++ b/src/support/enemies.js @@ -14,7 +14,7 @@ export class Enemies { this.baseSprite = ENEMIES_CONFIG[type].spriteStart; this.spawnRange = { low: 500, - high: 4000 + high: 8000 } this.spawnEnemy(); diff --git a/src/support/enemiesConfig.js b/src/support/enemiesConfig.js index 1421371..355a05d 100644 --- a/src/support/enemiesConfig.js +++ b/src/support/enemiesConfig.js @@ -1,6 +1,6 @@ export const ENEMIES_CONFIG = { 'basic1': { - 'spread': 25, + 'spread': 35, 'health': 25, 'fullHealth': 25, 'speedLow': 25, @@ -20,5 +20,16 @@ export const ENEMIES_CONFIG = { 'spriteSheet': 'basic-enemies', 'dropLow': 5, 'dropHigh': 10 + }, + 'basic3': { + 'spread': 25, + 'health': 300, + 'fullHealth': 300, + 'speedLow': 20, + 'speedHigh': 30, + 'spriteStart': 20, + 'spriteSheet': 'basic-enemies', + 'dropLow': 8, + 'dropHigh': 16 } } \ No newline at end of file diff --git a/src/support/interfaceManager.js b/src/support/interfaceManager.js index 4d80d01..544449d 100644 --- a/src/support/interfaceManager.js +++ b/src/support/interfaceManager.js @@ -245,10 +245,21 @@ export class InterfaceManager { showTowers() { this.towerDisplay = this.scene.add.container(); - this.gridAdd(0, 0, 'Gatlin Gun', 100, 'gun'); - this.gridAdd(0, 1, 'Flamethrower', 150, 'gun'); - this.gridAdd(1, 0, 'Laser', 200, 'gun'); - this.gridAdd(1, 1, 'Cannon', 200, 'cannon'); + let x = 0; + let y = 0; + for (const type in TOWERS_CONFIG) { + const tower = TOWERS_CONFIG[type]; + this.gridAdd(x, y, tower.name, tower.cost, type); + x++; + if (x > 6) { + y = 2; + x = 0; + } + } + // this.gridAdd(0, 0, 'Gatlin Gun', 100, 'gun'); + // this.gridAdd(0, 1, 'Flamethrower', 150, 'gun'); + // this.gridAdd(1, 0, 'Laser', 200, 'gun'); + // this.gridAdd(1, 1, 'Cannon', 200, 'cannon'); } gridAdd(x, y, text, cost, type) { @@ -395,7 +406,6 @@ export class InterfaceManager { this.scene.levelScene.towerManager.createTower(type, tileX, tileY); this.scene.removeGold(TOWERS_CONFIG[type].cost); - console.log(this.scene.levelScene.towers.countActive()); } // Clear Tower Selection Regardless diff --git a/src/support/waveConfig.js b/src/support/waveConfig.js index 8083936..12fa3d2 100644 --- a/src/support/waveConfig.js +++ b/src/support/waveConfig.js @@ -11,7 +11,7 @@ export const WAVE_CONFIG = { // Schedule 1: { begin: 0, - basic1: 5 + basic1: 5, }, 2: { begin: 15, @@ -54,7 +54,27 @@ export const WAVE_CONFIG = { }, 3: { begin: 30, - basic2: 8 + basic2: 8, + basic3: 1 + } + }, + // Wave + 4: { + // Schedule + 1: { + begin: 0, + basic1: 10, + basic3: 2 + }, + 2: { + begin: 15, + basic1: 8, + basic2: 3, + basic3: 2 + }, + 3: { + begin: 30, + basic3: 4 } } } diff --git a/src/support/waveManager.js b/src/support/waveManager.js index d984e46..276169b 100644 --- a/src/support/waveManager.js +++ b/src/support/waveManager.js @@ -171,16 +171,13 @@ export class WaveManager { } spawnSchedule() { - if (this.scheduleInfo.hasOwnProperty('basic1')) { - //console.log('Spawn',this.scheduleInfo.basic1,'Basic1 enemies'); - for (let e = 0; e < this.scheduleInfo.basic1; e++) { - const enemy = new Enemies(this.scene, 'basic1', this.spawnX, this.spawnY, this.path); - } - } - if (this.scheduleInfo.hasOwnProperty('basic2')) { - //console.log('Spawn',this.scheduleInfo.basic2,'Basic2 enemies'); - for (let e = 0; e < this.scheduleInfo.basic2; e++) { - const enemy = new Enemies(this.scene, 'basic2', this.spawnX, this.spawnY, this.path); + for (let i = 1; i <= 10; i++) { + // Basic Enemies + if (this.scheduleInfo.hasOwnProperty(`basic${i}`)) { + let type = `basic${i}`; + for (let e = 0; e < this.scheduleInfo[type]; e++) { + const enemy = new Enemies(this.scene, type, this.spawnX, this.spawnY, this.path); + } } } } @@ -193,7 +190,7 @@ export class WaveManager { const width = this.scene.levelMap.width; const height = this.scene.levelMap.height; const grid = []; - console.log('width', width, 'height', height); + // Create a grid based on collision data for (let y = 0; y < height; y++) { grid[y] = [];