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

Lurkers: first playthrough: Stuck

I have looked up guids and help but i can’t find how to fix my character not moving

while True:
    enemyIndex = 0
    enemies = hero.findEnemies()
    while enemyIndex < 6:
        enemy = enemies[enemyIndex]
        if enemy.type == "shaman":
            while enemy.health > 0:
                hero.attack(enemy)
                enemyIndex += 1

Im probably missing an obvious thing but i can’t see it

Hello and welcome to the fourm

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Check if there is an enemy and also check if it’s type is shaman:

if enemy:
    if enemy.type == "shaman":

Then inside the if enemy (but outside the if enemy.type == “shaman”), keep your incrementation there.

if enemy:
    if enemy.type == "shaman":
        #the rest of your code
    enemyIndex+=1

To help simplify that you might want to do this

if enemy and enemy.type == "shaman"

No you don’t. You need to increment enemyIndex even if the enemy is not a shaman.