Hi there
Got a slight problem (maybe) here with threads and waiting for action from a player in a game. The play() method keeps cycling through the NPCs, checking if each is faster than the player. If the player has not acted yet that round and is faster, the waitForPlayer() method is called until the player has acted (another method changes playerDone to true). What I am curious about is whether there is a way to make the main()
thread just sit there and wait for an event to come in signalling that the player has acted, the same way the Swing event dispatch thread works? That way waitForPlayer() could just chill out instead of running through a while loop until the boolean is changed, and return when an event has come in signalling the players action. There seem to be some serious holes in my logic here, but I'm working on this myself so I don't have anyone to bounce ideas off. Kind of stuck in a vacuum.
Muchas gracias!
[ September 17, 2004: Message edited by: Ray Muirhead ]
[ September 17, 2004: Message edited by: Ray Muirhead ]