my code is # The function defines a parameter called target
def cleaveWhenClose(target):
if hero.distanceTo(target) < 5:
pass
# Put your attack code here
# If cleave is ready, then cleave target
hero.cleave(enemy)
# else, just attack target
!
if enemy:
enemy = hero.findNearestEnemy()
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)
if enemy:
hero.attack(enemy)
and i have been on this for a few weeks i am very confused with what i go incorrect pls someone help me(preferably post the answer) Thank you.