[SOLVED]Sarven desert - hot gate

i need help. I don’t know hot to say " If the enemy on the left of the pet

// Use voice commands to command the artillery.

while(true) {
    var enemy = pet.findNearestEnemy();
    if(!enemy) {
        continue;
    }
    // Scouts are fast. We need stop them. 
    if(enemy.type == "scout") {
        var distance = pet.distanceTo(enemy);
        if(pet.isReady("cold-blast") &&  distance < 5) {
            pet.coldBlast();
        }
    }
    else {
        // If the enemy on the left of the pet:
     
        if(enemy < pet) {
            // Say  "left".
            pet.say("left");
        }
        // If the enemy on the right of the pet:
        if(enemy > pet) {
            // Say  "right".
         pet.say("right");   
        }
    }
}

You would compare if the enemy’s position x is greater or less than your pet’s position x. Then you would say left or right depending on where the enemy is.

thank you very much!!!

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.