The student is trying to create his card. I am including a link to the card so you can see the code. He keeps getting a message that says, “Cannot read property x undefined.” or sometimes it says “Cannot read property y undefined.” I think it is because he has all the variables in an if statement inside the draw loop. The reason he is doing this is because he does not want anything to show up until the user pushes the space key. Is there another way for him to make this happen?
Currently the purple and red aliens are only created if the
if condition is met. You want to take all the sprites in the game and create them/scale them outside of the
if statement. That cleared up the warnings, but I don’t know what else the students wanted the game to do…
Hope that helps!
Thank you, that’s what I was thinking as well. The student is wanting the first scene to be plain white with the directions/words on it, then when the left mouse button is pushed he wants it to change scenes to the grass with the aliens that move. When I had him move the sprites outside of the if statement, it gives grey boxes where the sprites would be.
This appears to be working properly now. Was the student able to fix it?