Help with Rich Forager


#1

I’m having trouble with the level Rich Forager… (this is my first post)
Please help, BTW this is python.

loop:
    flag = self.findFlag()
    enemy = self.findNearestEnemy()
    item = self.findNearestItem()


    if flag:
        self.pickUpFlag(flag)

    elif enemy:
        self.attack(enemy)
        
    elif item:
            pos = item.pos
            itemX = pos.x
            itemY = pos.y
            self.moveXY(pos.x, pos.y)

#2

Code looks fine on first glance; what problem are you seeing (just getting killed?) You might want to use cleave and make sure you have enough armor to survive.


#3

Why define ItemX and ItemY if you aren’t going to use them? If you define them you might as well use them in your code like

self.moveXY(ItemX, ItemY)

Other than that, just make sure you have a good amount of help and good luck with the level.


#4

Hey Kyang,
I had trouble at first too, but used “cleave” to much success. Part of the trick is placing a flag slightly before the enemies to allow them time to bunch up around you AND avoid being hit too much.


#5

This was the topic I was in about using loops in Rich Forager. Not sure if it would help too:

http://discourse.codecombat.com/t/level-rich-forager/1885?u=romanriot


#6

My hero is just plain standing there, what do I do. After I go through it she just stands there, not getting killed though. Can u help?


#7

nvm I forgot about falling the flags, now i just die, I don’t have enough gems to buy more armor