Return to Thornbush Farm

Basically, when i do maybeBuildTrap, it doesn’t make the trap, even when an ogre is in my face. I tried this once. By the way, this is python.
Heres my code:

# The function maybeBuildTrap defines TWO parameters!
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)
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)
    

for hero.buildXY inside maybeBuildTrap you can’t say the position of the fire trap just put in x and y

1 Like

Ah. Thanks, milton! You helped me, which was cool of you.

There is return to thornbrush farm A same thing

Ok, now it says the maybeBuilds arent defined.

That is supposed to be maybeBuildTrap() @AlwaysConfused.

Right, i tried that, and half my code went white/cyan and then didnt do my code.

Please can you post your updated code @AlwaysConfused?

Can you send a link to this level?
Lydia

Sorry I took long replying; I didn’t know you replied because I was trying to find a solution to Fragile Maze without going to GitHub (which is absolutely gruelling). Here is the link @Lydia_Song:

This is supposed to be
hero.buildXY("fire-trap", x, y)
Lydia