[Solved]What does the duck mean?

image
my code:

# You'll need good strategy to win this one!
# Your clone will have the same equipment you have!
# But, they're not very skilled at using special powers.
while True:
    enemy = hero.findNearestEnemy()
    if enemy.distance < 10:
        hero.attack(enemy)
    if hero.health < hero.maxHealth/2:
        hero.jumpTo(36,53)

this is where the error is:

  if enemy.distance < 10:

thanks moon!

Well, firstly try rewriting this line of code,

what line?
(0000002)

I gtg to sleep.Bye!sorry

its ok we all have to sleep.

Uhhhh, it’s supposed to be hero.distanceTo(enemy)… I think you should have already learned this in the forest.

1 Like

And the argument needs to be a position, so like:
Javascript:

{x: 36, y: 53};

Python:

{"x": 36, "y": 53}

oh ok i’ll try that
i haven’t played in a while so i forgot

or if you have vectors.

Vector(36,53)

Bruh, he isn’t even in the Mountains yet, how would he know about vectors???

idk but u can do,
while loops, for loops and if/else and while True loops with no programiticon

True, but you wouldn’t be able to see how if you didn’t remember.

don’t get off topic.

Well technically it’s not off-topic, but thats good idea.

The problem is that you haven’t checked if the enemy exists.

And what moonwatcher said.

i did here
(2000000)

you still need to do enemy && hero.distanceTo(enemy) or enemy and hero.distanceTo(enemy) to check if the enemy exists or it will throw an error.

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