[SOLVED] Operation ´Killdeer´ LvL help ( Python)

i dont know whats wrong whith my code. I saw some other solutions but they didnt worked.
Her is my Code:

   def shouldRun():
       if hero.health < hero.maxHealth / 2:
           return True
           return False
   enemy = hero.findNearestEnemy()
   while True:
       if shouldRun == True:
           hero.moveXY(75, 37)

Hi @paddok, welcome to the CodeCombat Discourse! :tada:
There are two problems here:
Firstly this line:

If you want to “call” (that is “use”) a function that you have defined (here: shouldRun()), you need to call it using brackets after the name like when you defined it. shouldRun(), instead of shouldRun. That’s purely technical.
Secondly: the position of this line:

I’ll let you think about that one. (Remember that a variable only changes inside a loop…).


Hey Danny,
thank you for your help. Everything is working :smiley: I had a few problems by reading you solution because im just 13 Years old and a German boy :open_mouth: But it worked! We read us ;D

1 Like

now that you found the answer u need please make sure to click the solution box with a check mark next to the comment that gave u the solution and i will put the title to solved.

Welcome‌ ‌welcome‌ @paddok ‌to‌ ‌the‌ ‌forum!‌ ‌It‌ ‌is‌ ‌a‌ ‌lovely‌ ‌place‌ ‌where‌ ‌you‌ ‌can‌ ‌share‌ ‌all‌ ‌kinds‌ ‌of‌ stuff‌ ‌(appropriate‌ ‌of‌ ‌course),‌ ‌share‌ ‌bugs,‌ ‌and‌ ‌even‌ ‌get‌ ‌assistance‌ ‌for‌ ‌code!‌ ‌We‌ ‌suggest‌ ‌that‌ ‌you‌ ‌review‌ ‌this‌ ‌topic‌ ‌which‌ ‌shows‌ ‌all‌ ‌essentials‌ ‌of‌ ‌this‌ ‌board!‌ ‌And‌ ‌we‌ ‌suggest‌ ‌you‌ ‌review‌ this topic‌ ‌which‌ ‌shows‌ ‌how‌ ‌to‌ ‌post‌ ‌your‌ ‌code‌ ‌correctly!‌ ‌Thanks!!‌ ‌ :partying_face: :partying_face:

Be sure to check the tick mark next to the comment you found most helpful!
Lydia‌ ‌


This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.