I do not know why my hero wont attack exept the first two dudes. here is my code:
while True:
hero.moveXY(87, 71)
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if item is not None:
hero.moveXY(item.pos.x, item.pos.y)
if enemy is not None and enemy.type != "sand-yak":
dist = hero.distanceTo(enemy)
if (enemy.type == 'thrower'):
hero.attack(enemy)
hero.attack(enemy)
elif (hero.isReady("power-up") and (enemy.type == "burl" or enemy.type == "ogre")):
hero.powerUp()
else:
if (hero.isReady("power-up")):
hero.powerUp()
else:
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
nevermind. I got it.
@Pameleen can you put [SOLVED] in the title?
I got it @WaWa_Yang
20 chars
1 Like
sry I just relized it did not work oops
while True:
hero.moveXY(67, 71)
enemy = hero.findNearestEnemy()
if enemy:
hero.attack(enemy)
hero.attack(enemy)
if hero.isReady("cleave"):
if :
hero.cleave(enemy)
else:
hero.attack(enemy)
i am just going to be done for the day.
first of all you just need one attack
this seems a bit messed up delete the if : after the if hero.isReady(“cleave”):
2 Likes
why is this extra if here?
2 Likes