Return-to-thornbush-farm


#1

Peasant spawns on top. Orge kills peasant. :с


#2

You have to build a fire-trap to kill the ogre instead of a fence.

hero.buildXY(“fire-trap”, x, y)

Hope this helps


#3

Oh, my stupid mistake! Thanks!


#4

Unbeatable!!! >:(
I hate this level, I can’t beat it


#5

What do you need help with?


#6

@_TD_RodYT : I don’t know if this was @Simon_Yang’s problem, but I’m also running into trouble.

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.


#7

Whoops. Nevermind.

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.