First, thanks so much for Code Combat. I’m working on changing careers by learning how to code. I’m fairly new to coding, so I’m sure there is a simple answer to this question that I’m just not seeing.
On “Patrol Buster”, I wrote a code where the warrior kills each enemy and returns to the center of the map. It works fine, but I keep getting an “Unexpected Token” error. It has to do with “dead”, but the code works. I tried re-writing several different ways using else, elif, and such, but I can’t figure it out. Below is my code, thanks for the help!
loop: enemy = self.findNearestEnemy() if enemy: self.attack(enemy) if enemy dead: self.moveXY(35, 30)
I’ve also tried if enemy health = 0, same effect.