feat: Enhanced enemy spawning, tower display, and wave progression

- Implemented dynamic zoom controls with mouse position centering
- Increased spawn range for enemies from 4000 to 8000 units
- Adjusted basic1 enemy spread from 25 to 35 units
- Added new basic3 enemy type with increased health and damage
- Refined tower display system to dynamically populate based on configuration
- Enhanced wave manager to support variable enemy types (basic1-basic10)
- Expanded wave configuration with additional waves including new enemy types
- Improved zoom limiting and camera positioning logic

These changes improve gameplay balance, expand enemy variety, enhance user interface responsiveness, and provide more flexible level design capabilities.
This commit is contained in:
Brian Fertig 2025-09-01 21:43:14 -06:00
parent aa8cabc90f
commit 7180612aab
8 changed files with 73 additions and 35 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

View File

@ -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) => {

View File

@ -14,7 +14,7 @@ export class Enemies {
this.baseSprite = ENEMIES_CONFIG[type].spriteStart;
this.spawnRange = {
low: 500,
high: 4000
high: 8000
}
this.spawnEnemy();

View File

@ -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
}
}

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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] = [];