while True:
currentHealth = hero.health
healingThreshold = hero.maxHealth / 2
# If your current health is less than the threshold,
# move to the healing point and say, “heal me”.
# Otherwise, attack. You’ll need to fight hard!
if currentHealth < healingThreshold:
hero.moveXY(65, 46)
hero.say(“heal me”)
else:
enemy = hero.findNearestEnemy()
hero.attack(enemy)
this is the problem it shows
i need this tomorrow by 7:00 so can sombody post the code plz
Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!
Since you need it for tomorrow, ive formatted it for you(next time do as @cheddarcheese and @Rachel699 said pls)
while True:
currentHealth = hero.health
healingThreshold = hero.maxHealth / 2
# If your current health is less than the threshold,
# move to the healing point and say, “heal me”.
# Otherwise, attack. You’ll need to fight hard!
if currentHealth < healingThreshold:
hero.moveXY(65, 46)
hero.say(“heal me”)
else:
enemy = hero.findNearestEnemy()
hero.attack(enemy)
Like I said that is fine but some people may take something like that as an offence. I am just making sure that you to don’t fight while you are helping someone. End of discussion. If you want to continue talking to me please take it to a PM.