Peasant spawns on top. Orge kills peasant. :с
You have to build a fire-trap to kill the ogre instead of a fence.
hero.buildXY(“fire-trap”, x, y)
Hope this helps
Oh, my stupid mistake! Thanks!
I hate this level, I can’t beat it
What do you need help with?
I’ve followed the code offered:
# 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: # Use buildXY to build a "fire-trap" at the given x and y. hero.buildXY("fire-trap", enemy.pos.x, enemy.pos.y) 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)
But then my hero just goes running over to the nearest enemy, and won’t build anything.
I’m tempted to cheap shot out, since I have a shield with a good bash, and could just have him bash the ogres to keep 'em off the peasants, but I’d rather try and make it through.
My issue was that I coded the hero to build the trap under the enemy (
"fire-trap", enemy.pos.x, enemy.pos.y) instead of at the generic variable x and y.