Make Test Disapear after a certain condition has been met

csd-unit-3

#1

My students are making a games now. They are having a blast. We have are having a problem makeing text disappear of the screen . They want a title of their game to appear for a short while and then disappear. I can use the text command to get the title to appear, the question is how can I clear it?


#2

You can clear it by not drawing it the next time through the loop and redrawing the background or another sprite.
This can be done with an if/else statement.
You just need a mechanism to change the value of condition. Use a counter variable and

if (counter < 50)
{//draw text}
else
{//don't}

counter = counter + 1;

or by mousePressedOver(sprite) over a certain sprite.

var condition = true ;

if (condition == true)
{
    text("draw me", 200,200);
}
else
{
  //don't draw me anymore. 
}

if (mousePressedOver(sprite))
{
   condition = false ;
}