link: Game Lab - Code.org
Error message: Line: 81: Error: Maximum call stack size exceeded.
This is happening whenever student tries to press space to get rid of the start screen. A line of code that worked before is highlighted as the issue, even though it worked at some point before, Student cannot reset the game after they get the error message unless they refresh the website as a whole.
Highlighted code: player.setAnimation(“playerfaceright”");
Here’s my thought process and how I went about troubleshooting this one because I haven’t run into it before …
In searching that error code, it looks like this is usually caused by recursion (ie. repeating something in somewhat of an infinite loop). I didn’t see that happening here, but I also didn’t see how that line of code was necessary because the character is already facing that direction. When I removed that conditional block and the line throwing the error, I ran the program again.
Then, I got another similar error caused by the “draw” block on line 129. Again, I couldn’t tell what that draw block was supposed to do, so I removed it.
Then, the program seemed to work, so I added back the original blocks (the ones that threw the error at first) and it worked fine … SO … long story short …
I believe it’s the draw block in line 129 that is causing the problem. Maybe they meant it to be a “drawSprites” block? The draw by itself doesn’t do anything…
Thank you! The student was able to proceed based on your feedback.