Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Stillness in motion Help ME Somebodey


This is my code I don’t know whats wrong with it?

while True:
enemy = hero.findNearestEnemy(enemy)
# If there is an enemy, then…
if enemy:
# Create a distance variable with distanceTo.
distance = hero.distanceTo(enemy) <5
# If the distance is less than 5 meters, then attack.
# Else (the enemy is far away), then shield.
distance = hero.distanceTo(enemy)
hero.moveXY(40, 34)
# Else (there is no enemy)…


Seems like you are missing the call to shield for one. I’m using Lua so my code looks a little different. Aren’t you also supposed to cleave? You might want to try resetting the map and filling in the instructions the comments give. I would just paste my code but I’m not sure that’d really be helping you.


Okay thanks you I will go and check.


It says you should shield[, but I will see if cleaving works and allows me to win.


You’re supposed to set it to do both depending on the conditions.


Okay that was what I was missing in my code.


Thank you so much your a great friend


I’m really glad I could help! I wish you the best with your future coding adventures :slight_smile:


Thank you and to you too.