Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

(HELP) computer science 5 "TO ARMS!" [SOLVED]

#1

my code seems to work in the level, my hero moves between the points and wakes up the NPC’s but i don’t finish getting through all the rows to “wake up” all the soldiers/archers.


var sergeant =  hero.findNearest(hero.findFriends());
var stepX = sergeant.tentDistanceX;
var stepY = sergeant.tentDistanceY;
var tentsInRow = 5;
var tentsInColumn = 4;


var firstX = 10;
var firstY = 14;

while(true) {
    for (var x = firstX; x < 61; x += stepX) {
        for (var y = firstY; y < 78; y += stepY) {
            hero.moveXY(x, y);
            hero.say("GO");
        }
    }
}

hero.moveXY(6,9);


0 Likes