@Override
    public void update() {
        if (!GameServer.users.isEmpty()) {
            double dist = Math.sqrt(Math.pow(targetX - x - 30, 2) + Math.pow(targetY - y - 30, 2));

            if (dist < startAttackDistance) {
                GameServer.sendToAll(this.toString() + " ATTACK");
                attack = true;
            } else {
                if (attack && dist > endAttackDistance) {
                    GameServer.sendToAll(this.toString() + " STOPATTACK");
                    cancelAttack();
                }
                if (!attack) {
                    double tx = targetX - x, ty = targetY - y;
                    x += (tx / dist) * monsterSpeed;
                    y += (ty / dist) * monsterSpeed;

                    GameServer.sendToAll(this.toString());
                }

            }
        }
    }