loop:
enemies = self.findEnemies()
enemyIndex = 0
coins = self.findItems()
coinIndex = 0
self.moveXY(53, 18)
while len(enemies) > enemyIndex:
enemy = enemies[enemyIndex]
enemyIndex += 1
if enemy:
while enemy.health > 0:
if self.isReady("power-up"):
self.powerUp()
elif self.isReady("bash"):
self.bash(enemy)
else:
self.attack(enemy)
while len(coins) > coinIndex:
coin = coins[coinIndex]
coinIndex += 1
if enemies:
break
if coin:
self.moveXY(coin.pos.x, coin.pos.y)
I’ve been trying to make my hero stop grabbing coin and attack an enemy if there is one but he either attacks only enemies or grabs coins. I’ve tried using distanceto, if not enemy, and a few other attempts. Any ideas?