I’m trying to code a card game in AS3 for a class project. There are three computer players and one human player. The code to run the overall game is something like this:
function playGame(){
initialSetup();
for(var i:int = 0; i< 5; i++){ //there are five rounds
for each(var player in playersArray){
player.takeTurn();
}
}
}
The problem is that when it is the human player’s turn, they need to be able to press various buttons (bet, redraw, etc) before their turn ends. How can I make my game loop wait while the player does stuff? I tried creating a humansTurn boolean, setting it to true when it’s the human player’s turn, and having a while(humansTurn){} loop run until the boolean is turned off when the player clicks a button, but Flash freaked out and gave me a “timed out after 15 seconds” error. I also can’t see how splitting playGame() into two functions with a TimerEvent could work either. Please help!