[SOLVED] Python Blind Distance

And that is not why the code does not work. The code will work with the two of them if @Armin_Alimohammadi checks and fixed what I mentioned above. But it is a good observation and @Armin_Alimohammadi should also look to fix that. (Only the second one should be removed)

Andrei

1 Like

    # Call nearestEnemyDistance() and
    # save the result in the variable enemyDistance.
    enemyDistance = nearestEnemyDistance()

what is save the result what code i need to make?

Here put instead of hero.distanceTo the variabile enemyDistance.

And delete this line, not the other.

Andrei

1 Like

what do i have to change in line 3 i tried changing it but it did not do anything

Hi hi12345678,

Welcome to the forum!

Can you post your code, and we can have a look at what you’re doing? There’s instructions on how to format it here.

Jenny

Hello, i hope your having a good day but i need some help! heres my code!

`while True:
    # Call nearestEnemyDistance() and
    # save the result in the variable enemyDistance.
    enemyDistance = nearestEnemyDistance()
    # If the enemyDistance is greater than 0: 
    if hero.distanceTo > 0:
        enemyDistance = nearestEnemyDistance()
        # Say the value of enemyDistance variable.
        hero.say("enemyDistance")
      `

Remove the quotes(") in the hero.say() function. Also, please stick with one thread in the future :slight_smile:

Im not sure whats happening, but I think it may either be an error (like the games error) or you have a problem in your code

1 Like

No you are confusing javascript with python. In python (which is the one you are coding right now) you dont need to do var = you just do x = 80 or whatever

1 Like

take out the result = 0.

Welcome to the forum this person is not active anymore.