[Help] Flash TCG: Waiting for User Input
I'm leaving the old problems up for reference, in case anyone else could use the solutions.
(Resolved)I'm trying to make a trading card game in Flash, and I'm struggling with one major problem; how to get the 100+ cards into Flash, and have Actionscript be able to access them.
My current plan is to make the Card class have a field for a MovieClip, so each card can store it's own image. Then I would have an array with one of each type of card for reference. That way, decks could be represented with a simple array of Numbers.
The problem I'm having is getting a MovieClip from the Library into Actionscript without importing it as a class, or using instance names. Is this even possible? If not, does anybody have any other recommendations for how to do this?
(Resolved) I have each player's turn broken up into two phases. I'm trying to figure out how to best implement the phase transitions while the player is selecting cards.
This is what I have so far. I'm going to add a button to turn playphase to false.
Code:
playphase = true;
stage.addEventListener(MouseEvent.CLICK,pickFromHand);
while(playphase){
}
stage.removeEventListener(MouseEvent.CLICK,pickFromHand);
I handle all the actions of the phase inside of pickFromHand.
I needed a way to suspend the main game method until the player is done with their phase. I came up with this, but I'm hesitant to use what is essentially a while(true) loop. Is there a better way to wait for user input?
(For clarity, the main method of the game is NOT called on every frame)