JAVA: How do I accept input during a certain period of time only
Posted
by sebrock
on Stack Overflow
See other posts from Stack Overflow
or by sebrock
Published on 2010-04-30T16:15:34Z
Indexed on
2010/04/30
16:17 UTC
Read the original article
Hit count: 185
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.
© Stack Overflow or respective owner