It's a Game where you can "roll the dice"
I want that the number 1-6 is getting spinned in the Console until the Player is pressing a Key. The number that was displayed when pressing, is the number that is going to be selected.
Thank You!
My code looks like that:
do {
System.out.print("\b1");
Thread.sleep(100);
if (System.in != null) {
dice1Player = 1;
break;
}
System.out.print("\b2");
Thread.sleep(100);
if (System.in != null) {
dice1Player = 2;
break;
}
System.out.print("\b3");
Thread.sleep(100);
if (System.in != null){
dice1Player = 3;
break;
}
System.out.print("\b4");
Thread.sleep(100);
if (System.in != null){
dice1Player = 4;
break;
}
System.out.print("\b5");
Thread.sleep(100);
if (System.in != null){
dice1Player = 5;
break;
}
System.out.print("\b6");
Thread.sleep(100);
if (System.in != null){
dice1Player = 6;
break;
}
Thread.sleep(100);
} while (!Thread.currentThread().isInterrupted());