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

Level: Brittle Morale


Can anybody help me with this problem?


You are trying to increase enemyIndex in the beggining of the loop and as the result can get the wrong values.

Look. For example the enemies length is 5 and the current iteration enemyIndex is 4. So while enemyIndex < enemies.lenght is ok. Then enemyIndex += 1 and enemyIndex == 5. So you are trying to read enemies[5] but it’s out of the list.


Bryukh: I see it now… Thanks for your time!