Debugging Help for a Student Game

I’m not sure what is happening with her game, but we can’t really get anything to move after one or two button presses.

https://studio.code.org/projects/gamelab/dRFlgP6q7YKtLL95mWJc74zNeTsFCfNn5VJQBlNH0K4

Thanks in advance for any help!

@gina1,

So … I believe I have found where the game is freezing. I created a counter variable at the beginning of the game to see if the draw loop was repeating. Then, I added one to the counter each time through the draw loop. Then I started watching the value of the counter (using the watcher debug at the bottom right corner of the screen). The game stalled every single time on the 50th cycle through the draw loop.

Then, I noticed that your student is running a modulo function on line 34. I’m guessing they want to add a new imposter each 50 times through the draw cycle … I changed that to 100 instead of 50 and then the program stalled at 100.

Then, I replaced line 39 with this:

console.log(timeslooped); (timeslooped was the counter variable I made).

Once I did that, the program started working just fine and it didn’t stall anymore, so your program is hanging on the group.add statement. You may want to review the documentation and see if they can reformulate that line of code.

I don’t have a ton of experience using the group.add functionality, so I’m not 100% sure why it’s not working, but that’s where the problem lies.

Mike