Add boss hit feedback with flash and floating damage numbers
This commit is contained in:
@@ -15,6 +15,7 @@ const PULL_CHARGE_TIME = 2.5;
|
||||
const PULL_DAMAGE = 25;
|
||||
const PULL_TIME = 0.6;
|
||||
const SLAM_TIME = 0.5;
|
||||
const HIT_FLASH_TIME = 0.14;
|
||||
const SWEEP_RADIUS = 11;
|
||||
const SWEEP_DURATION = 3.6;
|
||||
const SWEEP_HIT_WIDTH = 1.2;
|
||||
@@ -56,6 +57,7 @@ export class Krake extends Enemy {
|
||||
private puddles: InkPuddle[] = [];
|
||||
private skinMat!: THREE.MeshToonMaterial;
|
||||
private darkMat!: THREE.MeshToonMaterial;
|
||||
private hitFlash = 0;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -212,6 +214,18 @@ export class Krake extends Enemy {
|
||||
this.ensureEffects(game.scene);
|
||||
this.waveTime += dt;
|
||||
|
||||
// Hit-Feedback: kurz weiss aufblitzen + leichtes Pulsieren
|
||||
if (this.hitFlash > 0) {
|
||||
this.hitFlash -= dt;
|
||||
this.skinMat.color.set(0xffffff);
|
||||
this.darkMat.color.set(0xffffff);
|
||||
this.model.scale.setScalar(1 + (this.hitFlash / HIT_FLASH_TIME) * 0.05);
|
||||
} else {
|
||||
this.skinMat.color.set(this.enraged ? 0x8a2233 : 0x8a4a9a);
|
||||
this.darkMat.color.set(this.enraged ? 0x551520 : 0x5a2a6a);
|
||||
this.model.scale.setScalar(1);
|
||||
}
|
||||
|
||||
// Tentakel wippen
|
||||
for (let i = 0; i < this.tentacles.length; i++) {
|
||||
this.tentacles[i].rotation.z = Math.sin(this.waveTime * 2.2 + i * 0.9) * 0.25;
|
||||
@@ -469,6 +483,16 @@ export class Krake extends Enemy {
|
||||
}
|
||||
}
|
||||
|
||||
override takeDamage(
|
||||
damage: number,
|
||||
game: Game,
|
||||
withKnockback = true,
|
||||
sourcePos?: THREE.Vector3
|
||||
) {
|
||||
super.takeDamage(damage, game, withKnockback, sourcePos);
|
||||
this.hitFlash = HIT_FLASH_TIME;
|
||||
}
|
||||
|
||||
protected onDeath(_game: Game) {
|
||||
this.cleanupEffects();
|
||||
this.beginFadeDeath();
|
||||
|
||||
Reference in New Issue
Block a user