Hello,
I really need help on the level clash of clones.Can you help me?
Here is my code:
loop:
enemies = self.findEnemies()
enemyIndex = 0
# Make an array of all enemies.
while enemyIndex < len(enemies):
currentTarget = enemies[enemyIndex]
enemyIndex += 1
distance = self.distanceTo(currentTarget)
# If it’s a sand-yak, move to next enemy in the array.
if currentTarget.type is “sand-yak”:
pass
# If it’s out of range, move to the next enemy in the array.
elif distance > 37:
pass
# Else, we target it.
elif currentTarget.health > 0:
# If it’s too close, move back.
if distance < 18:
self.moveXY(self.pos.x - 15, self.pos.y)
# Else, we attack it.
else:
self.attack(currentTarget)