import { BaseEnemy } from './BaseEnemy.js'; export class SwarmerEnemy extends BaseEnemy { constructor(scene, x, y, player) { super(scene, x, y, player, { color: 0xff9900, 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; } 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.body.body.setVelocity( Math.cos(angle) * this.speed, Math.sin(angle) * this.speed ); } }