Nested For Loops

[Posts in the debugging category need to have the following pieces of information included in order to help other teachers or our moderator team best help you. Feel free to delete everything in brackets before posting your request for debugging help.]

Link to the project or level:(Game Lab - Code.org)]
What I expect to happen:
I’m trying to use For Loops to create a group of ‘bullets’ each with their own name, and a group of targets, each with their own name using the values of the For Loop to number the items in each group.
I’ve been able to use a For Loop to give instructions that when each ‘bullet’ hits an target the target goes away. But when I use nested For Loops to iterate through all possible combinations of the different bullets hitting each different target, I get a white screen with no visuals.
What actually happens:
I get a white screen with no visuals. Also, in the Debug Console the Debug Commands section seems to be stuck in a loop.
What I’ve tried:
I changed the background color and that showed just the background, then moved the drawSprites up before the nested ForLoop which revealed the characters (motionless). It’s like the nested ForLoop froze the process.
Any ideas?

Your FOR loops are incrementing “i” rather than “m” & “k”. I think that is the issue.

1 Like

Ah yes! @jwilson25 is correct. On lines 49 and 50.