{SOLVED}While Orges were sleeping level help

Okay, so I do everything but 1 task. I don’t defeat an orge. Other than that, my code works. What is wrong with it?

Code
# Enemies are sleeping. It's the perfect time for sabotage!
points = [{"x": 21, "y": 8}, {"x": 33, "y": 8},
    {"x": 45, "y": 8}, {"x": 57, "y": 8}, {"x": 68, "y": 8},
    {"x": 68, "y": 18}, {"x": 68, "y": 28}, 
    {"x": 68, "y": 38}, {"x": 68, "y": 48},
    {"x": 68, "y": 58}, {"x": 56, "y": 58},
    {"x": 44, "y": 58}, {"x": 32, "y": 58}, 
    {"x": 20, "y": 58}, {"x": 10, "y": 60}]

pointIndex = 0;

while pointIndex < len(points):
    point = points[pointIndex];
    hero.moveXY(point["x"], point["y"])
    enemy = hero.findNearestEnemy()
    coin = hero.findNearestItem()
    # Attack only if the enemy.team is "ogres"
    # AND the enemy's health is less than 10
    if enemy.type == "orge" and enemy.health < 15:
        hero.attack(enemy)
    # Collect a coin if coin.value is less than 5
    # AND its distance is less than 7
    if coin.value < 7:
        hero.move(coin.pos)
    # Attack only if the enemy.health is less than 10
    # AND the enemy's type is "skeleton".
    if enemy.type == "skeleton" and enemy.health < 10:
        hero.attack(enemy)
    pointIndex += 1

Munchkin not ogre :)

more like enemy.team not enemy.type and careful with the spelling of ogre

this should be 10 not 15

maybe check this again

1 Like

Yeah what Aya said xD

1 Like

actually nevermind i figured out my problem. Aya, you were very helpful.

1 Like

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