I am currently working on a console based Tetris game in Java.
The user has to be able to move the Tetrimino (piece) left and right. This is impossible with KeyEvents because everything is done with only the console.
The only solution I was able to come up with was using a scanner and see when the user typed either "Q" for left or "D" for right. Only 1 issue, the program always waits for user input before it continues to the next line of code.
while(run) {
...
String movement = sc.nextLine();
...
}
Is there a way so that the program keeps running the while loop without waiting for input every loop?
Edit: The solution shown here (suggested as duplicate) only works on unix based systems.