A Flash Developer Resource Site

Results 1 to 14 of 14

Thread: [Help] Importing Cards for TCG

Threaded View

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    7

    [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)
    Last edited by TheAmishPirate; 02-13-2010 at 09:32 PM. Reason: Problem solved, new one found

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center