The Two Flowers


#1


#2

Hector is the peasant, he won’t attack, he just tries to evade ogres. You don’t need to give him any commands. :slight_smile:


#3

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” ?


#4

self.command(soldier, "attack", enemy)

Yes, self is Anya. Who is soldier?


#5

OMG, THX.

def commandSoldiers():
    soldiers=self.findByType("soldier")
    for soldier in soldiers:
        enemy = soldier.findNearestEnemy()
        self.command(soldier, "attack", enemy)