Enemies = True
while Enemies:
target = self.findNearestEnemy()
self.attack(target)
Enemies = target
self.moveDown()
self.moveRight()
self.moveRight()
And this for the next level…
self.moveRight()
loop:
Enemies = True
while Enemies:
target = self.findNearestEnemy()
Enemies = target
if target:
self.attack(target)
self.moveRight()
self.moveRight()
and this for the next level… I just do not think these a good solutions, and this one specifically is a glitch were the character continues to loop into the wall and no enemies can attack it…
self.moveRight()
loop:
Enemies = True
while Enemies:
target = self.findNearestEnemy()
Enemies = target
if target:
self.attack(target)
self.attack(self.findNearestEnemy())
if(self.findNearestEnemy()!=True):
self.moveDown()
self.moveRight()
self.moveRight()