Thunderhooves can't move? [JavaScript] [SOLVED]


#1
// Move right, to the oasis.
// Build a "fence" above or below when you see a yak.

while(true) {
    var yak = hero.findNearestEnemy();
    if (yak) {
        // If yak.pos.y is greater than hero.pos.y
        if (yak.pos.y > hero.pos.y) {
            // buildXY a "fence" 10m below the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y -10);
        // else: 
        }else if (yak.pos.y < hero.pos.y) {
            // buildXY a "fence" 10m above the yak.
            hero.buildXY("fence", yak.pos.x, yak.pos.y +10);
    } else {
        // moveXY right 10m towards the oasis.
        hero.moveXY(hero.pos.x +10, hero.pos.y);
    }
}
}

I press play and I stand still lol no errors are popping up and not sure where I’m wrong. I’m thinking it has something to do with my else if statements but not entirely sure…


#2

Solved, }} else {

(Just typing more so that I can reach the 20 character post limit)

Sorry I keep making posts and then solving them -_- They’re always rookie mistakes lol