JAVA: How do I accept input during a certain period of time only
- by sebrock
Im trying to do a simple game where I continually need input from players. This needs to happen during a certain time period only. Everything that is sent after that will be discarded. After the time period a new game starts. So:
Start game
Wait for input from all players during 10 seconds
10 secs no more input
Calculate the winner and do some stuff
Goto 1.
I was thinking using a timer and timertask to keep track of time and maybe use a boolean variable that changes from "open" to "closed" after 10 seconds? Please give me some advise on this.