// W tym poziomi użyjesz funkcji z dwoma parametrami
// Look at the structure below, notice how there are two arguments.
// These are both accessible within the function.

function checkAndAttack(x, y) {
    // First move to the coordinates provided by the parameters.
     hero.moveXY(x, y);
    // Następnie sprawdź czy jest wróg


    var enemy = hero.findNearestEnemy();
        // Jeżeli jakiś jest to zaatakuj go
        if (enemy) {
            hero.attack(enemy);
        }
}

checkAndAttack(24, 42);
checkAndAttack(27, 60);
// Podejdź do ostatnich 3 X  i pokonaj wszystkie pozostałe munchkiny
checkAndAttack(42, 50);
checkAndAttack(39, 24);
checkAndAttack(55, 29);

 

 

Projektuję strony www Lublin na Joomla i WordPress

Codecombat - backwoods ambush a - Zasadzka w dziczy 2- JavaScript