This site requires JavaScript, please enable it in your browser!
Greenfoot back
enw
enw wrote ...

2024/12/14

Need showText to go away after a couple seconds

enw enw

2024/12/14

#
I made an if statement that activates showText, among other things, and I want to get rid of the text after a couple of seconds. I know how to get rid of the text itself, I just don't know how to do that after a certain period of time. How would I?
danpost danpost

2024/12/15

#
enw wrote...
I made an if statement that activates showText, among other things, and I want to get rid of the text after a couple of seconds. I know how to get rid of the text itself, I just don't know how to do that after a certain period of time. How would I?
Simply add an int showTextTimer to the class. You want that as long as it has a value of zero, no text will be showing:
if (showTextTimer > 0 && --showTextTimer == 0) showText("", /** wherever */??, ??);
Just set a positive value (maybe 180) to the field when the text is displayed.
You need to login to post a reply.