U3L17: Interactive Card Student Game Project

Following are the issues a student is having with their code:

My function “instruction()” is supposed to show an instruction page when the question mark is clicked on, and then disappear when the space bar is pressed. Currently, the page will appear if the question mark is clicked, but remains frozen no matter what new commands I input into the code (ie pressing the spacebar to return function). I would like to know if there was any chance that I could continue on with my original idea of having a pop-up instruction page. Otherwise I might have to default to just place the instructions directly onto the background but I prefer a pop-up of instructions.

Any suggestions? TY!

Student link: Code.org - Game Lab


When I run the code, I get a typeError at line 120. I think what is happening is the following:

Your student is trying to use a function (.visible) on a function, but .visible can only be used on objects (sprites), not functions. You can’t really make a function visible. You normally just call the function.

So, you could call the function and it should run fine, but the way it is set up, you can’t make it invisible when you are done. You would need to unravel what was done by hiding the text and the rectangle.

One way this could be done would be to use variables to store the position of the rectangle and then make that change (to a location off screen) when you are done. This would be easier if it were a sprite because you could use the .visible function on a sprite, but it’s harder to do on a rectangle.

So, I may try using a sprite, and I’m sure it could be done, just not in the way they are doing it right now.