44 lines
899 B
JavaScript
44 lines
899 B
JavaScript
import { Zombie } from './Zombie.js';
|
|
|
|
export class MegaTank extends Zombie {
|
|
constructor(
|
|
x,
|
|
y,
|
|
target,
|
|
{
|
|
container,
|
|
viewport,
|
|
speed = 30,
|
|
size = 64,
|
|
color = [0.55, 0.28, 0.12, 1],
|
|
health = 18,
|
|
knockback = 90,
|
|
scoreValue = 15,
|
|
spawnOnDeath = () => {},
|
|
spawnCount = 3,
|
|
} = {},
|
|
) {
|
|
super(x, y, target, {
|
|
container,
|
|
viewport,
|
|
speed,
|
|
size,
|
|
color,
|
|
health,
|
|
knockback,
|
|
scoreValue,
|
|
onDeath: (mega) => {
|
|
for (let i = 0; i < spawnCount; i += 1) {
|
|
const angle = (i / spawnCount) * Math.PI * 2;
|
|
const offset = mega.size + 28;
|
|
spawnOnDeath(
|
|
mega.pos.x + Math.cos(angle) * offset,
|
|
mega.pos.y + Math.sin(angle) * offset,
|
|
target,
|
|
container,
|
|
);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
} |