Hot Gate I need help with this level

I need help with level Hot Gate in Sarven desert whenever I say left or right the artillery don’t do anything
My code looks like this:

while True:
    enemy = pet.findNearestEnemy()
    if not enemy:
        continue
    if enemy.type == "scout":
        distance = pet.distanceTo(enemy)
        if pet.isReady("cold-blast") and  distance < 5:
            pet.coldBlast()
    else:
        if enemy.pos.x < pet.pos.x:
            hero.say("left!") 
        if pet.pos.x < enemy.pos.x:
            hero.say("right!")
        pass

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

okay then I will then when I find it

Please format your code so we can understand it.

sorry this is my first time posting anything correctly

Did you mean to do this like twice

Right should be this

if enemy.pos.x > pet.pos.x:
           
           # Say  "right".
           pet.say("Right")

And left should be this

if enemy.pos.x < pet.pos.x:
            
            # Say  "left".
            pet.say("Left")
1 Like

thank you the hero was saying right and left not the pet

Glad to help. It is important not to mix things up. Don’t worry it happens to me(a lot).

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