Add advanced enemy types with new spritesheet and updated wave scheduling
This commit is contained in:
parent
706d5b2cde
commit
91a5919fe4
Binary file not shown.
|
After Width: | Height: | Size: 450 KiB |
Binary file not shown.
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,19 @@ 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
|
||||||
this.createAnim('side', ENEMIES_CONFIG[this.type].spriteStart, ENEMIES_CONFIG[this.type].spriteStart+2);
|
if (this.type.indexOf('basic') === 0) {
|
||||||
this.createAnim('up', ENEMIES_CONFIG[this.type].spriteStart+6, ENEMIES_CONFIG[this.type].spriteStart+7);
|
this.createAnim('side', ENEMIES_CONFIG[this.type].spriteStart, ENEMIES_CONFIG[this.type].spriteStart+2);
|
||||||
this.createAnim('down', 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+8);
|
||||||
this.createAnim('die', ENEMIES_CONFIG[this.type].spriteStart+8, ENEMIES_CONFIG[this.type].spriteStart+9, 0);
|
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);
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue