"Defeat the ogres scout"

Hi there in the level “Saven Road

when i put the follow code :

# Llegar al oasis. Cuidado con los nuevos enemigos: ogros exploradores!
# Subir y hacia la derecha añadiendo a la posición X e Y actual.
Enemigo = hero.findNearestEnemy()
while True:
    # Si hay un enemigo, ataca.
    if Enemigo:
	    hero.attack(Enemigo)
    # De lo contrario, sigue moviéndote hacia arriba y hacia la derecha. 
    else:
	    X = hero.pos.x + 1
	    Y = hero.pos.y + 1
	    hero.moveXY(X, Y)

i reach the Oasis, but my hero, never attack the ogres scout, and they reach with me the oasis xD

Try defining your variable as enemigo instead of Enemigo.

Intenta definir tu variable como enemigo en lugar de Enemigo.

That don’t make any difference, because is just a variable name, besides, in the previous levels I have not had problems using practically the same parts of code

Eso no hace diferencia alguna, debido a que es solo el nombre de una variable. Ademas, en los niveles anteriores no he tenido problemas usando prácticamente las mismas partes de código!

Captura%20de%20pantalla%20-%20280218%20-%2019%3A32%3A58|690x479

With your variable outside the while True loop, it is a global variable. Global variables are generally not a good idea and should be avoided. Move your variable definition inside the while True loop and before the if enemy conditional statement.

for me is some strange, because on all levels i play before, ever i put that goblal variables, i just in that level, make that.

well i put the variable, inside the “while True:” and now it’s working

# https://codecombat.com/play/level/sarven-road?
# Llegar al oasis. Cuidado con los nuevos enemigos: ogros exploradores!
# Subir y hacia la derecha añadiendo a la posición X e Y actual.
while True:
    # Si hay un enemigo, ataca.
    enemigo = hero.findNearestEnemy()
    if enemigo:
	    hero.attack(enemigo)
    # De lo contrario, sigue moviéndote hacia arriba y hacia la derecha. 
    else:
	    X = hero.pos.x + 1
	    Y = hero.pos.y + 1
	    hero.moveXY(X, Y)

and i think the bug its, with the first code i put, my hero never attack the ogres, but the level mark positive “Defeat the ogre scouts”