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:
parent
aa8cabc90f
commit
7180612aab
Binary file not shown.
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 117 KiB |
Binary file not shown.
|
|
@ -57,23 +57,23 @@ export class Level extends Phaser.Scene {
|
||||||
}
|
}
|
||||||
|
|
||||||
addControls() {
|
addControls() {
|
||||||
// this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => {
|
this.input.on('wheel', (pointer, gameObjects, deltaX, deltaY) => {
|
||||||
// const zoomSpeed = 0.1;
|
const zoomSpeed = 0.1;
|
||||||
// if (deltaY < 0) {
|
if (deltaY < 0) {
|
||||||
// // Zoom in
|
// Zoom in
|
||||||
// this.cameras.main.zoom += zoomSpeed;
|
this.cameras.main.zoom += zoomSpeed;
|
||||||
// } else if (deltaY > 0) {
|
} else if (deltaY > 0) {
|
||||||
// // Zoom out
|
// Zoom out
|
||||||
// this.cameras.main.zoom -= zoomSpeed;
|
this.cameras.main.zoom -= zoomSpeed;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Limit zoom range to prevent extreme zoom levels
|
// Limit zoom range to prevent extreme zoom levels
|
||||||
// this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2);
|
this.cameras.main.zoom = Phaser.Math.Clamp(this.cameras.main.zoom, 0.5, 2);
|
||||||
|
|
||||||
// // Zoom toward mouse position
|
// Zoom toward mouse position
|
||||||
// const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main);
|
const worldPoint = this.input.activePointer.positionToCamera(this.cameras.main);
|
||||||
// this.cameras.main.centerOn(worldPoint.x, worldPoint.y);
|
this.cameras.main.centerOn(worldPoint.x, worldPoint.y);
|
||||||
// });
|
});
|
||||||
|
|
||||||
// Add camera panning functionality
|
// Add camera panning functionality
|
||||||
this.input.on('pointerdown', (pointer) => {
|
this.input.on('pointerdown', (pointer) => {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export class Enemies {
|
||||||
this.baseSprite = ENEMIES_CONFIG[type].spriteStart;
|
this.baseSprite = ENEMIES_CONFIG[type].spriteStart;
|
||||||
this.spawnRange = {
|
this.spawnRange = {
|
||||||
low: 500,
|
low: 500,
|
||||||
high: 4000
|
high: 8000
|
||||||
}
|
}
|
||||||
|
|
||||||
this.spawnEnemy();
|
this.spawnEnemy();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
export const ENEMIES_CONFIG = {
|
export const ENEMIES_CONFIG = {
|
||||||
'basic1': {
|
'basic1': {
|
||||||
'spread': 25,
|
'spread': 35,
|
||||||
'health': 25,
|
'health': 25,
|
||||||
'fullHealth': 25,
|
'fullHealth': 25,
|
||||||
'speedLow': 25,
|
'speedLow': 25,
|
||||||
|
|
@ -20,5 +20,16 @@ export const ENEMIES_CONFIG = {
|
||||||
'spriteSheet': 'basic-enemies',
|
'spriteSheet': 'basic-enemies',
|
||||||
'dropLow': 5,
|
'dropLow': 5,
|
||||||
'dropHigh': 10
|
'dropHigh': 10
|
||||||
|
},
|
||||||
|
'basic3': {
|
||||||
|
'spread': 25,
|
||||||
|
'health': 300,
|
||||||
|
'fullHealth': 300,
|
||||||
|
'speedLow': 20,
|
||||||
|
'speedHigh': 30,
|
||||||
|
'spriteStart': 20,
|
||||||
|
'spriteSheet': 'basic-enemies',
|
||||||
|
'dropLow': 8,
|
||||||
|
'dropHigh': 16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -245,10 +245,21 @@ export class InterfaceManager {
|
||||||
|
|
||||||
showTowers() {
|
showTowers() {
|
||||||
this.towerDisplay = this.scene.add.container();
|
this.towerDisplay = this.scene.add.container();
|
||||||
this.gridAdd(0, 0, 'Gatlin Gun', 100, 'gun');
|
let x = 0;
|
||||||
this.gridAdd(0, 1, 'Flamethrower', 150, 'gun');
|
let y = 0;
|
||||||
this.gridAdd(1, 0, 'Laser', 200, 'gun');
|
for (const type in TOWERS_CONFIG) {
|
||||||
this.gridAdd(1, 1, 'Cannon', 200, 'cannon');
|
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) {
|
gridAdd(x, y, text, cost, type) {
|
||||||
|
|
@ -395,7 +406,6 @@ export class InterfaceManager {
|
||||||
|
|
||||||
this.scene.levelScene.towerManager.createTower(type, tileX, tileY);
|
this.scene.levelScene.towerManager.createTower(type, tileX, tileY);
|
||||||
this.scene.removeGold(TOWERS_CONFIG[type].cost);
|
this.scene.removeGold(TOWERS_CONFIG[type].cost);
|
||||||
console.log(this.scene.levelScene.towers.countActive());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear Tower Selection Regardless
|
// Clear Tower Selection Regardless
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export const WAVE_CONFIG = {
|
||||||
// Schedule
|
// Schedule
|
||||||
1: {
|
1: {
|
||||||
begin: 0,
|
begin: 0,
|
||||||
basic1: 5
|
basic1: 5,
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
begin: 15,
|
begin: 15,
|
||||||
|
|
@ -54,7 +54,27 @@ export const WAVE_CONFIG = {
|
||||||
},
|
},
|
||||||
3: {
|
3: {
|
||||||
begin: 30,
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,16 +171,13 @@ export class WaveManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnSchedule() {
|
spawnSchedule() {
|
||||||
if (this.scheduleInfo.hasOwnProperty('basic1')) {
|
for (let i = 1; i <= 10; i++) {
|
||||||
//console.log('Spawn',this.scheduleInfo.basic1,'Basic1 enemies');
|
// Basic Enemies
|
||||||
for (let e = 0; e < this.scheduleInfo.basic1; e++) {
|
if (this.scheduleInfo.hasOwnProperty(`basic${i}`)) {
|
||||||
const enemy = new Enemies(this.scene, 'basic1', this.spawnX, this.spawnY, this.path);
|
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);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +190,7 @@ export class WaveManager {
|
||||||
const width = this.scene.levelMap.width;
|
const width = this.scene.levelMap.width;
|
||||||
const height = this.scene.levelMap.height;
|
const height = this.scene.levelMap.height;
|
||||||
const grid = [];
|
const grid = [];
|
||||||
console.log('width', width, 'height', height);
|
|
||||||
// Create a grid based on collision data
|
// Create a grid based on collision data
|
||||||
for (let y = 0; y < height; y++) {
|
for (let y = 0; y < height; y++) {
|
||||||
grid[y] = [];
|
grid[y] = [];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue