I’ve tried everything, but no mater what I do when the hero gets to the top two enemy’s spawn and she does nothing, I thought ah i might just be to fast, so i put a move back to the middle and let them come to her. but to no avail she just sits there and lets them attack her when shes attacked the rest. I can’t find much online on this level so im not sure if im doing it correct.
# This shows how to define a function called cleaveWhenClose
# The function defines a parameter called target
def cleaveWhenClose(enemy):
if hero.distanceTo(enemy) <5:
pass
# Put your attack code here
# If cleave is ready, then cleave target
hero.isReady("cleave")
hero.cleave(enemy)
# else, just attack target!
else:
hero.attack(enemy)
# This code is not part of the function.
while True:
enemy = hero.findNearestEnemy()
if enemy:
# Note that inside cleaveWhenClose, we refer to the enemy as target.
cleaveWhenClose(enemy)
Note it doesn’t work with or without the hero.moveXY in there she will run to the top killing everything and then stop on the last two