(Python) Bosque Aislado 9/120

Hola estoy teniendo problemas en este nivel, no comprendo correctamente el procedimiento que debo seguir.
Todas las pistas las tengo en ingles y no puedo copiar el texto para poder traducirlas aparte :disappointed_relieved:

Dejo lo que he agregado al código y captura de pantalla:

# Munchkins are attacking!
# The swarms will come at regular intervals.
# Whenever you can, cleave to clear the mass of enemies.

while True:
    enemy = hero.findNearestEnemy()
    # Use an if-statement with isReady to check "cleave":
    if hero.isReady("cleave"):
        # Cleave!
        hero.attack(enemy)
    # Else, if cleave is not ready:
    else:
        hero.moveXY(50, 10)
        # Attack the nearest ogre!
        

imagen

you are to cleave the enemy, not attack. you need the line hero.cleave() instead of hero.attack()

1 Like

gracias @Seojin_Roy_Lee ahora si pude resolverlo use antes cleave pero no vivia el tiempo necesario y probe cambiando la ubicación del movimiento.

Pude solucionarlo con tu ayuda :smiley:

# Munchkins are attacking!
# The swarms will come at regular intervals.
# Whenever you can, cleave to clear the mass of enemies.

while True:
    enemy = hero.findNearestEnemy()
    # Use an if-statement with isReady to check "cleave":
    if hero.isReady("cleave"):
        # Cleave!
        hero.cleave(enemy)
        hero.moveXY(40, 30)
    # Else, if cleave is not ready:
    else:
        hero.attack(enemy)
        # Attack the nearest ogre!
        hero.attack(enemy)

you only need hero.attack() once. Also, put all of that in if enemy: statement as it would check if the enemy exists.

1 Like

hola gracias por la observación.

La parte de :

if enemy:

por el momento no lo comprendo bien y creo que es lo que me falta para poder solucionar el nivel 10 estoy parado ahi no comprendo correctamente, abrire un nuevo tema para ese nivel (Python) Bosque Aislado 10/120

Saludos! :smiley::beers: