I’m sure it’s just me, but my hero does not seem to move smoothly.
Also any tips to clean up my code would be great. Thanks
# This level shows how to define your own functions.
# The code inside a function is not executed immediately. It’s saved for later.
# This function has your hero collect the nearest coin.
items = self.findItems()
for item in items:
nearestCoin = self.findNearest(over2) if nearestCoin: self.move(nearestCoin.pos) # This function has your hero summon a soldier. def summonSoldier(): if self.costOf("soldier")<self.gold: self.summon("soldier") # This function commands your soldiers to attack their nearest enemy. def commandSoldiers(): for soldier in self.findFriends(): enemy = soldier.findNearestEnemy() if enemy: self.command(soldier, "attack", enemy) # This function is to bash and cleave def bashCleave(): e1=self.findNearest(self.findEnemies()) if e1: if self.isReady("cleave"): self.cleave(e1) else: if self.isReady("bash"): self.bash(e1) else pass loop: # In your loop, you can "call" the functions defined above. # The following line causes the code inside the "pickUpNearestCoin" function to be executed. pickUpNearestCoin() summonSoldier() commandSoldiers() bashCleave()