Ważna jest broń - kusza strzelająca trzema bełtami i zbroja

// Go to the far right edge of the level to find new areas.
// Check the guide for more details.
while(true) {
    var flag = hero.findFlag("green");
    var enemy = hero.findNearestEnemy();
    hero.moveXY(hero.pos.x + 5, hero.pos.y);
    if (flag) {
        hero.jumpTo(flag.pos.x , flag.pos.y);
        hero.pickUpFlag(flag);
    }
    if (enemy) {
        hero.attack(enemy);
    }
   
}

 

===============

 Inne rozwiązanie

==========

// Go to the far right edge of the level to find new areas.
// Check the guide for more details.
 while (true) {
     hero.moveXY(hero.pos.x +10, hero.pos.y);
     var flag = hero.findFlag("green");
    var enemy = hero.findNearestEnemy();
    var item = hero.findNearestItem();
    
    if (!enemy && item && item.type == "potion") {
    hero.moveXY(item.pos.x, item.pos.y);
        }
    if (flag) {
            hero.moveXY(flag.pos.x, flag.pos.y);
            hero.pickUpFlag(flag);
        }
                var enemy = hero.findNearestEnemy();        
    if (enemy) {
                hero.attack(enemy);
            }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

   
   

 

 


 

Projektuję strony www Lublin na Joomla i WordPress

 

Problem jest taki że przy 3 przeciwniku trzeba się przemieścić bo inaczej nie wyszukuje go, i trzeba aktywować potem ducha

 

// Twój bohater nie zna imion wrogów!
// Okulary dają ci zdolność findNearestEnemy.

// Assign the result of hero.findNearestEnemy() to the variable enemy1:
var enemy1 = hero.findNearestEnemy();
// enemy1 now refers to the nearest enemy. Use the variable to attack!
hero.attack(enemy1);
hero.attack(enemy1);

// Keep moving right, but adjust up and down as you go.

while(true) {
    var enemy = hero.findNearestEnemy();
    var xPos = hero.pos.x + 5;
    var yPos = 17;
    if(enemy) {
        // Adjust y up or down to get away from yaks.
        if(enemy.pos.y > hero.pos.y) {
            // If the Yak is above you, subtract 3 from yPos.
            yPos -= 3;
        }

// Ucieknij na prawą stronę doliny..

// Funkcja  porusza bohaterem w dól i w prawo.
function moveDownRight(shift) {
    hero.moveXY(hero.pos.x + shift, hero.pos.y - shift);
}

// Funkcja  porusza bohaterem w  górę i w prawo.
function moveUpRight(shift) {
    // Uzupełnij  tą funkcję.
    hero.moveXY(hero.pos.x + shift, hero.pos.y + shift);
}