Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Taunting Level Help

while True:
    enemy = hero.findNearestEnemy()
    # If enemy.type is “munchkin”:
    if enemy and enemy.type == "munchkin":
        # Then attack it:
        hero.attack(enemy)
        # If the enemy’s type is “brawler”:
    elif enemy.type == "brawler":
            # Then say something to call the brawler"
            hero.say("I don't think so brawler")
            hero.say("I don't think so ogre")
pass

Now it is saying that line 13 cannot read property ‘type’ of null

What if there is no enemy?

Try to do elif enemy and enemy.type == „brawler“

Mumbo_6

2 Likes

Never mind I completed it. It was my hero so I changed and it was a success.

1 Like

@Mumbo_6 its fine if they ask for help as long as they try by themselves first cause that is what the forum is for

Congrats!

Mumbo_6

20