while(true) {
    var enemy = hero.findNearestEnemy();
    if(enemy) {
        // Find the distance to the enemy with distanceTo.
        var distance = hero.distanceTo(enemy);
        // If the distance is less than 5 meters...
        if(distance < 5){
                  


            // ... if "cleave" is ready, cleave!
            hero.cleave(enemy);
        }
            // ... else, just attack.
            else {
                hero.attack(enemy);
            }
    }
}

 }

}

 

 

Projektuję strony www Lublin na Joomla i WordPress