Making text disappear

I have a student that is creating his Interactive Card in Lesson 17. He has his instructions on the screen and wants to make the text disappear when he hits the spacebar so only his new text appears.

Hi @skschiltz,

Welcome to the forum! There are many ways to do this and @mwood’s works great! It is a requirement for my classes to have instructions in their final project so I use this template that we code together in class. I’ve added comments to explain the code as well. I pose questions before each step as we code together.

  • Could I create a variable that indicates start screen should be on or off?
  • If start screen is on, how would I display instructions?
  • If start screen should be off, how would that change my variable and text that is drawn to screen (or not drawn;)

Hope this helps

1 Like

We tried the empty string. The text still shows.

Link to project

The student has tried multiple ways to make this work. The new text appears with the spacebar, but we cannot get the instructions to disappear.

So close! The program needs to draw the background each time through the loop. Move the background block inside the function draw loop. It should be the first block in the draw loop.

I was going back and reading through this. Does the student want a toggle between “Press space bar” and “Happy Halloween”? Again, the existing project is very close! You still need to add the background to the first line of the draw loop as stated before. Then, if you think about it, the start variable should only be true IF the space bar is down ELSE the start variable should be false. So, just add an else to the “if start == true” statement.
FYI - you do not need the last if statement that makes the text empty if start == false.

Good luck!

It works. His biggest problem was the background.

1 Like