Hector is the peasant, he won’t attack, he just tries to evade ogres. You don’t need to give him any commands.
Since you are the hero, then you can refer to the hero with self (Python, Lua), this (JavaScript, Clojure), or @ (CoffeeScript). This means that everytime you type self, this, or @ into the code editor, it is referring to you, the hero of the game.
self==hero==“Anya” ?
self.command(soldier, "attack", enemy)
Yes, self is Anya. Who is soldier?
OMG, THX.
def commandSoldiers():
soldiers=self.findByType("soldier")
for soldier in soldiers:
enemy = soldier.findNearestEnemy()
self.command(soldier, "attack", enemy)
For some strange reason, I can’t get into the level itself. It keeps saying “Unable to Load Level” and I have been trying for a couple of days now.
Hi @abc, welcome to the CodeCombat discourse!
Please could you post a screenshot of your screen and tell me what type of browser you’re using. Have you accessed this level before and written any code?
Thanks
Danny
Yes, I have accessed it before. Now it works fine, I think it was an internet problem. Thanks for trying to help me.