Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Help with Lurkers please? [SOLVED]


Hey guys, sorry for constantly posting! I am trying to learn as much as I can and wrote my first line of code ever about 3 days ago! I am struggling with the Lurkers level currently and was wondering why my code was not working!

enemies = self.findEnemies()
enemyIndex = 0
    while enemyIndex < enemies.length:
        enemy = enemies[enemyIndex] 
            if enemy.type == 'shaman':
               while > 0:
                    enemyIndex += 1

  1. No need to indent the if statement under enemy =. Rule of thumb - no :, no indent for the line below (in python)
  2. The enemyIndex needs to be updated, whether or not the enemy.type == “shaman”. So, you need enemyIndex to line up with the enemy = statement as well. Currently, if you have any enemy out there other than a type shaman, the code will hang.

2a. Alternatively, do you have access to self.findByType() yet?
If you just want to kill enemy shaman, the first line could be corrected to:
enemies = self.findByType(“shaman”, self.findEnemies())


Thanks a ton. I can’t believe I didn’t catch that!