import { BaseEnemy } from './BaseEnemy.js'; export class SwarmerEnemy extends BaseEnemy { constructor(scene, x, y, player) { super(scene, x, y, player, { frameOffset: 3, radius: 8, hp: 15, speed: 160, xp: 8, contactDamage: 8, }); // Slight random offset so swarms don't stack perfectly this._offsetAngle = Math.random() * Math.PI * 2; this._wobble = Math.random() * 0.5; this._deathPulseColor = 0xff2222; this._deathSound = 'sfx-death-swarmer'; } _die() { this._gridDeathPulse(); super._die(); } update(delta) { super.update(delta); const t = this.scene.time.now * 0.001; const baseAngle = Phaser.Math.Angle.Between(this.x, this.y, this.player.x, this.player.y); const angle = baseAngle + Math.sin(t * 3 + this._offsetAngle) * this._wobble; this.sprite.body.setVelocity( Math.cos(angle) * this.speed, Math.sin(angle) * this.speed ); } }