loop:
enemy = self.findNearest(self.findEnemies())
if enemy and self.distanceTo(enemy) < 10:
newX = self.pos.x - 10
newY = self.pos.y
self.moveXY(newX, newY)
else:
otherX = self.pos.x + 10
otherY = self.pos.y
self.moveXY(otherX, otherY)
It’s giving me a token on the “else” . I have 2.5 speed boots and 15 glasses. Is it a bug or my mistake?
So many ways to break the code-presentation. I fixed your presentation-style, but your indentations are completely missing. Please post your code with your indentations, as a token-error is in my experience in most cases a hidden indentation-error.
In your case I’d guess that at least one of the three lines between the if
and the else
is not indented, and the compiler finds an else without a matching if. Just a wild guess though.