very new to java and Im trying to create a small text based choose your own adventure game. As the text you have to read for the game is appearing, im using Thread.sleep to give some time in between each line of text. My problem is the page gets filled quite easily this way with bulky chunks of using Thread.sleep. Is there any way I could maybe create an object that initiates the Thread.sleep command and I could simply call it so it would perform that waiting period.
I basically want to make the code below into an object and call it when I need that Thread.sleep action performed. So my code isnt so bulky and long.
try {
Thread.sleep(3000);
}
catch (InterruptedException ex)
{
}