const schema = require("@colyseus/schema"), GameObject = require("./GameObject.js"); const DEFAULT_VELOCITY = 1, DEFAULT_HEALTH = 100, DEFAULT_WIDTH = 50, DEFAULT_HEIGHT = 50, DEFAULT_DAMAGE = 10, DEFAULT_HIT_BOX_RADIUS = 30, DEFAULT_ENEMY_COLOR = "#3f0d76", DEFAULT_ENEMEY_TIP_COLOR = "#d2ccf3", DEFAULT_ENEMY_HEALTH_COLOR = "#d2ccf3", DEFAULT_ENEMY_HEALTH_WIDTH = 10, DEFAULT_ENEMY_HEALTH_RADIUS = 50; class Enemy extends GameObject { constructor(x, y, width, height, hitBoxRadius, velocity, direction, color) { super(x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_HIT_BOX_RADIUS, DEFAULT_VELOCITY, direction, DEFAULT_ENEMY_COLOR); this.lp = 100; } static createEnemy(rangeX, rangeY, targetX, targetY) { let xPos = parseInt(Math.random() * rangeX), yPos = parseInt(Math.random() * rangeY), direction = Math.atan2(targetY - yPos, targetX - xPos) * 180 / Math.PI; return new Enemy(xPos, yPos, direction); } } schema.defineTypes(Enemy, { lp: "number" }); module.exports = Enemy;