Underground Business help CPP

hello, This level is super wonky. I was trying to get the mimic to just travel the level itself via item location commands and blah blah. Yet, the mimics commands don’t loop and when I try to make the mimic search command loop it failed. Even breaking my whole code…EXCITING. I defaulted back to very basic commands. Now other problem. Hero doesn’t just walk back to the Red X. After having over 300 + gold he just stands there. solution to that. No enemy force him to walk back to the X. I don’t want that. I want it to play out. You have 300+ gold? great! Now scurry over to that X… So a little bit of help please.

auto onSpawn(auto event) {
    // Send the pet to walk around the dungeon:
    pet.moveXY(45, 60);
    pet.moveXY(70, 57);
    pet.moveXY(70, 36);
    pet.moveXY(70, 11);
    pet.moveXY(42, 10);
    pet.moveXY(21, 11);
    pet.moveXY(20, 34);
    // Don't forget to return it to the hero:
    pet.moveXY(hero.pos.x, hero.pos.y);
int main() {
    pet.on("spawn", onSpawn);
    auto coin = hero.findNearestItem();
    auto totalGold = 0;
    while(true) {
        // Guard peasants:
        auto enemy = hero.findNearestEnemy();
        if (enemy) {
            totalGold += coin.value;
            if (totalGold >= 300) {
        // When you have 300+ gold move to the red mark:
    hero.moveXY(50, 34);
    return 0;

Hi, @johny_johny , could you please send me the link to this lvl?

CodeCombat - Coding games to learn Python and JavaScript?

thanks, I’ll take a look!

oh, i’m sorry, I don’t know CPP too well to help you.Sorry.

nooo okay thanks for at least looking

1 Like