Well, this lvl looked very simple to me, so I was doing a mockup that would pickup coins at least there was an enemy near me, in which case I would to to the teleporter, how ever, the hero seems to ignore the enemy instruction and just go and pickup coins, what’s wrong?
No particular reason for no using nearest, just wanted to get better at the while function. Is there any reason to use self.move instead of self.move(x,y)?
Right there would be two ways to check to see any enemy is within 5:
Go through the enemies one a time to see if any are within 5. This would require a loop that goes through each enemy to see if it is in 5. You would want to use a for loop for this (although you don’t have to)
Only check to see if the nearest enemy is within 5 (because if the closest isn’t in 5, no enemy is within 5)
The second one is easier to code.
The difference between move() and moveXY() is that move only moves 1 step at a time and allows for other things to happen. moveXY() will move you to the point before other code will happen (like checking to see if enemies are close)