Add advanced enemy types with new spritesheet and updated wave scheduling

This commit is contained in:
Brian Fertig 2025-09-04 19:26:25 -06:00
parent 706d5b2cde
commit 91a5919fe4
6 changed files with 45 additions and 5 deletions

BIN
assets/advanced-enemies.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

BIN
assets/advanced-enemies.psd Normal file

Binary file not shown.

View File

@ -23,6 +23,10 @@ export class Level extends Phaser.Scene {
frameWidth: 50, frameWidth: 50,
frameHeight: 50 frameHeight: 50
}); });
this.load.spritesheet('advanced-enemies', 'assets/advanced-enemies.png', {
frameWidth: 150,
frameHeight: 150
});
this.load.spritesheet('towers', 'assets/towers.png', { this.load.spritesheet('towers', 'assets/towers.png', {
frameHeight: 150, frameHeight: 150,
frameWidth: 150 frameWidth: 150

View File

@ -33,10 +33,18 @@ export class Enemies {
const enemy = this.scene.add.sprite(spawnX, spawnY, ENEMIES_CONFIG[this.type].spriteSheet, ENEMIES_CONFIG[this.type].spriteStart); const enemy = this.scene.add.sprite(spawnX, spawnY, ENEMIES_CONFIG[this.type].spriteSheet, ENEMIES_CONFIG[this.type].spriteStart);
// Create Animations // Create Animations
if (this.type.indexOf('basic') === 0) {
this.createAnim('side', ENEMIES_CONFIG[this.type].spriteStart, ENEMIES_CONFIG[this.type].spriteStart+2); this.createAnim('side', ENEMIES_CONFIG[this.type].spriteStart, ENEMIES_CONFIG[this.type].spriteStart+2);
this.createAnim('up', ENEMIES_CONFIG[this.type].spriteStart+6, ENEMIES_CONFIG[this.type].spriteStart+7); this.createAnim('up', ENEMIES_CONFIG[this.type].spriteStart+6, ENEMIES_CONFIG[this.type].spriteStart+8);
this.createAnim('down', ENEMIES_CONFIG[this.type].spriteStart+3, ENEMIES_CONFIG[this.type].spriteStart+5); this.createAnim('down', ENEMIES_CONFIG[this.type].spriteStart+3, ENEMIES_CONFIG[this.type].spriteStart+5);
this.createAnim('die', ENEMIES_CONFIG[this.type].spriteStart+8, ENEMIES_CONFIG[this.type].spriteStart+9, 0); this.createAnim('die', ENEMIES_CONFIG[this.type].spriteStart+8, ENEMIES_CONFIG[this.type].spriteStart+9, 0);
}
if (this.type.indexOf('advanced') === 0) {
this.createAnim('side', ENEMIES_CONFIG[this.type].spriteStart+3, ENEMIES_CONFIG[this.type].spriteStart+5);
this.createAnim('up', ENEMIES_CONFIG[this.type].spriteStart+6, ENEMIES_CONFIG[this.type].spriteStart+7);
this.createAnim('down', ENEMIES_CONFIG[this.type].spriteStart, ENEMIES_CONFIG[this.type].spriteStart+2);
this.createAnim('die', ENEMIES_CONFIG[this.type].spriteStart+8, ENEMIES_CONFIG[this.type].spriteStart+9, 0);
}
// Generate unique ID for enemy // Generate unique ID for enemy
const uniqueId = Phaser.Math.Between(100000, 999999); const uniqueId = Phaser.Math.Between(100000, 999999);

View File

@ -31,5 +31,27 @@ export const ENEMIES_CONFIG = {
'spriteSheet': 'basic-enemies', 'spriteSheet': 'basic-enemies',
'dropLow': 8, 'dropLow': 8,
'dropHigh': 16 'dropHigh': 16
},
'advanced1': {
'spread': 0,
'health': 1200,
'fullHealth': 1200,
'speedLow': 50,
'speedHigh': 60,
'spriteStart': 0,
'spriteSheet': 'advanced-enemies',
'dropLow': 12,
'dropHigh': 20
},
'advanced2': {
'spread': 0,
'health': 1800,
'fullHealth': 1800,
'speedLow': 45,
'speedHigh': 55,
'spriteStart': 10,
'spriteSheet': 'advanced-enemies',
'dropLow': 15,
'dropHigh': 25
} }
} }

View File

@ -179,6 +179,12 @@ export class WaveManager {
const enemy = new Enemies(this.scene, type, this.spawnX, this.spawnY, this.path); const enemy = new Enemies(this.scene, type, this.spawnX, this.spawnY, this.path);
} }
} }
if (this.scheduleInfo.hasOwnProperty(`advanced${i}`)) {
let type = `advanced${i}`;
for (let e = 0; e < this.scheduleInfo[type]; e++) {
const enemy = new Enemies(this.scene, type, this.spawnX, this.spawnY, this.path);
}
}
} }
} }