Yakstraction - Error in my code?

Trying to get the hero to just go grab the gold first so I don’t have any lines for actually building decoys yet.

However, she seems to get stuck and not move any further. I’m wondering if I missed anything…if I try this.say(gold); it will respond with an error of “Say what?”

Any ideas what I did wrong in my code?


 // Build 4 decoys.
    // Each decoy costs 25 gold.
    // Check this.gold to know when you have enough to build one.
    // Keep a count of decoys you built as you go along.
    // Break out of the loop when you have built 4.
    var decoysBuilt = 0;
    var gold = 0;

    while (gold < 101) {
        item = this.findNearestItem();
        if (item) {
            position = item.pos;
            x = position.x;
            y = position.y;
            this.moveXY(x, y);
            gold = this.gold;
this.say("Done building decoys!");
// Go to the banker and report how many decoys you built.

Is this Decoy Drill or Yakstraction?

You have a while loop inside your normal loop; I would just use one or the other.

Weird…things started to work and the hero actually goes after the coins now.

This is to save Brandy with decoys so Yakstraction.

Ok! Switched to just a loop by converting the while to an if. Didn’t realize that the yaks will eat you too. LOL.

Passed the level.