Hi there, I need help with this. Possible problem. Look my code is there. I don’t know how to send my hero to center after he killed enemies, and after send to next location?
1 st | 2nd | 3rd |
---|---|---|
---- | ---- | ---- |
-h- | ---- | ---- |
-h– | ---- | ---- |
hero |
So, the first wave comes from first lot, hero goes there and stays there, 2nd wave comes from 2nd lot so hero still waiting there. and does not coming to the 2.nd lot. what should I do? It seems the code is ok? Isn’t it?
// Ogres are climbing the cliffs!
// Protect the peasants long enough for the militia to assemble.
while(true) {
var enemy = hero.findNearest(hero.findEnemies());
var flag = hero.findFlag();
if (flag) {
hero.pickUpFlag(flag);
}
else if (enemy) {
if (hero.distanceTo(enemy) <10 && hero.isReady(“cleave”)) {
hero.cleave(enemy);
}
else {
hero.attack(enemy);
}
}
else {
hero.say(“Send me to the central peasant”);
}
}