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

My hero won't summon anyone in Uneasy Truce


Hello everyone,

This is my code. My hero doesn’t summon any soldiers.

function findSouthernUnits(units) {
    var southernUnits = [];
    for(var i=0; i < southernUnits.length; i++) {
        var unit = units[i];
        if(unit.pos.y < hero.pos.y) {
            // Add the unit to the array with: push()
    return southernUnits;

while(true) {
    var friends = hero.findFriends();
    var enemies = hero.findEnemies();
    // Use findSouthernUnits to get enemies to the south.
var enemy = findSouthernUnits(enemies);
    // If there are more ogres south of you than friends.
    if (enemy.length > friends.length){
        // Then summon another "soldier".

What are you doing here in function findSouthernUnits(units)?

for(var i=0; i < southernUnits.length; i++)

check the default code

1 Like