Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Glitch with Sarven Sentry

in this level the X doesn’t move after the first 3 flag drops. I have to guess where the next enemy is coming.

Was this intentional?? or is this a glitch.

I can kill the ogres sometimes but no chance against the sand yaks.

also, when I lay a green flag my hero won’t pick up the flag the fence seems to be in the way. I get around this by placing the green flag some place else.

Hi @Thomas_Olson, please could you post your code (formatted as it instructs here: Link) along with a screenshot of your level screen and equipment so I can see your problem.
Thanks,
Danny

// Use different colored flags to perform different tasks.

while(true) {
var flag = hero.findFlag();
if (flag) {
if (flag.color == “black”) {
hero.buildXY(“fire-trap”, flag.pos.x, flag.pos.y);
}
hero.pickUpFlag(flag);
}
if (flag) {
if (flag.color == “green”) {
hero.buildXY(“fence”, flag.pos.x, flag.pos.y);
}
hero.pickUpFlag(flag);
}
// Build a “fence” at flagGreen’s position.

    // Pick up the flag!
    
// If there's a flagBlack...

    // Build a "fire-trap" at flagBlack's position.
    
    // Pick up the flag!
    
// Move back to the center.
hero.moveXY(43, 31);

}

Hi, you need to look for flag colors (as I remember doing it), you would do this:

flagBlack = hero.findFlag("black");
flagViolet = hero.findFlag("violet");
flagGreen = hero.findFlag("green");

Then you check whether they exist.
Also could you post you code again fully formatted, because I can’t see the indentation of the top half. (instructions here).
Thanks
Danny

So I am able to pick up the flags and build things. The real problem I see is after 3 enemies come the X doesn’t move anywhere so I have to guess because my hero is too slow for the sand yaks. Is this how the level was designed or is there a glitch??

I can’t seem to get the code to format based on the instuctions sorry…

Ok, the actual problem is that you’re building the trap first, then picking it up. Switch the order around and it will work. At least it did for me.
Danny