@PeterPalov here is the new topic

2 Likes

Instead of buildXY, use `maybeBuildTrap(x,y)` with the proper coordinates.

Is there an error?

i tried that but i keep on dieing

the numbers should be x an y here.

no none at all @Monsty

Change this to:

And all the others

Does it work now?

no this is what i have

``````# 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(43,19)
# Now use maybeBuildTrap at the bottom entrance!
maybeBuildTrap(25,34)
`````````

Put x, y instead of 43, 50

Over here.

there is an error now x is not defined

It should be this.

Does it work now?

still does not work what shoild i do

``````# 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", x, y)
while True:
# This calls maybeBuildTrap, with the coordinates of the top entrance.
maybeBuildTrap(43, 50)

# Now use maybeBuildTrap at the left entrance!
maybeBuildTrap(43,19)
# Now use maybeBuildTrap at the bottom entrance!
maybeBuildTrap(25,34)

``````

@Monsty

Switch these around.

Your coordinates for left and bottom are incorrect. Change those and you should be good.

how is this @brooksy125

2 Likes

This is good, it should work.

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