(python):Help on Long rang division[SOLVED]

This is my code:

# Destroy the mines!
# Use `say` to call out the range to the mines.
# Use division to calculate the range.

enemy = hero.findNearestEnemy()
distanceToEnemy = hero.distanceTo(enemy)
# Say first Range: distanceToEnemy divided by 3
hero.say(distanceToEnemy*3)
hero.say("Fire!")
# Say second range: distanceToEnemy divided by 1.5
hero.say(distanceToEnemy*1.5)
hero.say("Fire!")

# Say these things for motivation. Really. Trust us.
hero.say("Woo hoo!")
hero.say("Here we go!")
hero.say("Charge!!")

# Now, use a while-true loop to attack the enemies.
while True:
    if hero.canCast("drain-life", enemy):
        hero.cast("drain-life", enemy)

turn * into /

make this attack code

after this line add

hero.moveXY(distanceToEnemy, 0)

Thanks! I passed the level.

1 Like

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