Kithgard brawl help


#1

my code
while True:

enemy = hero.findNearestEnemy()
if(enemy):
    if hero.isReady("cleave"):
        hero.cleave(enemy)
    elif hero.canElectrocute(enemy):
            hero.electrocute(enemy)
    else:
        hero.attack(hero.findNearestEnemy()
item = hero.findNearestItem()
elif(item):
    hero.moveXY(item.pos.X, item.pos.Y)

it shows
fix you code
cannot read property ‘start’ of undefined


#2

Parenthesis should not be used around the variable enemy or item in the if or elif conditionals. Also, you have already defined enemy, therefore you shouldn’t be using its definition in your arguments for hero.attack. You used the correct argument in the cleave and electrocute statements. Do the same in attack argument.


#3

don’t define the item’s ‘x’ cordinate and ‘y’ cordinate in capitals