Kithgard Brawl 2 Help!

Here is my code:

while True:
if enemy:
if self.isReady(“cleave”):
self.findNearestEnemy()
enemy = self.findNearestEnemy()
ready = hero.isReady(“cleave”)
hero.cleave(enemy)
enemy = hero.findNearestEnemy()
hero.attack(enemy)

I don’t know why my hero just stands there. My armor is good…
Please help me. Thanx

you should try write: enemy = self.findNearestEnemy() after while-true loop and before if enemy:

1 Like

Okay, you probably did but I can’t tell if ou indented your code or not so that could be the problem.
Also “hero” and “self” are the same thing so it would be nice if you used one and not both. I recommend “hero” because it changes your view as a person who is controlling the hero, not the hero themself.

On line 4 I see

self.findNearestEnemy()

and I don’t see any reason for it to be there you would delete it
and you should put your enemy variable before the

if enemy:

because python reads from top to bottom and if you don’t do that it will just input null and the program will stop there most likely.

Also on line 6 there is

ready = hero.isReady("cleave")

has no use so that should also be deleted

And you don’t have to but when I do it most of the time I would use an if else statement.

sorry if that was too long I am in a bad mood.

Thanks you, @FlowerChi and @Ruslan_A Sorry if I bothered you

1 Like