Return to Thornbush Farm Help!

I have another account on Codecombat but I can’t use my other account because I messed that one up. Here is my code.

def maybeBuildTrap(x, y):
    # Use x and y as the coordinates to move to.
    hero.moveXY(x, y)
    enemy = hero.findNearestEnemy()
    if enemy:
        pass
        # Use buildXY to build a "fire-trap" at the given x and y.
        hero.buildXY("fire-trap", 43, 50)
        hero.buildXY("fire-trap", 25, 34)
        hero.buildXY("fire-trap", 43, 20)
while True:
    # This calls maybeBuildTrap, with the coordinates of the top entrance.
    maybeBuildTrap(43, 50)
    
    # Now use maybeBuildTrap at the left entrance!
    maybeBuildTrap(25, 34)
    # Now use maybeBuildTrap at the bottom entrance!
    maybeBuildTrap(43, 20)

Your function is written to build fire-traps at three specific locations if an enemy is present. It needs to be written to build a fire-trap at a later specified x,y location and then use the coordinates specified in the while True loop code.

# Use buildXY to build a "fire-trap" at the given x and y.

hero.buildXY("fire-trap", x, y)

The given x and y are specified in the while True code.

1 Like

Thank you I got passed it
18

1 Like

it worked for me too! Thanks MunkeyShynes