Getting error on line 16 methodname has a problem how do i fix this thanks
// If the peasant is damaged, the flowers will shrink!
function summonSoldiers() {
friends = hero.findFriends();
if (hero.gold >= hero.costOf("soldier")) {
hero.summon("soldier");
}
}
// Define the function: commandSoldiers
function commandSoldiers() {
friends = hero.findFriends();
for (var i = 0; i < friends.length ; i++) {
var enemy = friends[i].findNearestEnemy();
if (enemy) {
hero.command(friends[i], "attack", enemy);
}
}
}
// Define the function: pickUpNearestCoin
function pickUpNearestCoin() {
}
var peasant = hero.findByType("peasant")[0];
var friends = hero.findFriends();
while(true) {
summonSoldiers();
// commandSoldiers();
commandSoldiers();
// pickUpNearestCoin();
pickUpNearestCoin();
}
You’ve called the function “commandSoldiers”, but who are you really commanding?
Think who the function: hero.findFriends(); will return. Read the description of your Boss Star to see who it can summon / command.
After you’ve fixed that you just need to write your pickUpNearestCoin() function and you’re done. (I’ve checked you’re code and there aren’t any other errors.)