def shouldRun():
if hero.health < hero.maxHealth / 2:
return True
else:
return False
while True:
if shouldRun: #not sure if it's shouldRun() in java like python idk
hero.moveXY(75, 37)
else:
enemy = hero.findNearestEnemy() #btw you should add if enemy
hero.attack(enemy)
This should be if (shouldRun() == true) { because otherwise it’s not running the function. It’s like how in hero.findNearestEnemy(); you add parenthesis after hero.findNearestEnemy