A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29

Thread: solitaire game need help

  1. #21
    Senior Member
    Join Date
    May 2016
    Posts
    275
    very good
    It is better when the word appears, the timing begins, and not before the word appears in first time
    Can you modify this please?
    Last edited by kofa; 05-18-2022 at 11:59 AM.

  2. #22
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,243
    For line 7 of the solitaire_play script you would just need to change the 1 second delay to 0 seconds.

    Change 1000ms to 0ms
    PHP Code:
    var timeout_1=setTimeout(player_time,1000,turn); 
    PHP Code:
    var timeout_1=setTimeout(player_time,0,turn); 
    Line 54 I commented this out as well
    PHP Code:
    //_root.solitaire.solitaire_play.data_field.text="It is " + player_turn[turn] + " " + "turn." 
    I will get to fixing the bugs when I get time later if you want to list them, because i'm sure that when 1 player didn't make a move you want to give the other player a score?

    download solitaire 11

  3. #23
    Senior Member
    Join Date
    May 2016
    Posts
    275
    Allow me to re-explain the game:
    First press the red or black player button
    Secondly, the word appears and the timing begins
    Thirdly, Drag and drop the word card to the number card
    Fourth, press the other player's button to start the same steps

  4. #24
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,243
    I just added this function for the solitaire_play script called "released", it gets called when a card gets swiped to give the next user a turn with a timer.

    This is the function inside the solitaire_play script, so when a red card gets swiped up the card has its internal function for release & calls _parent.released("red"); which is in the function inside the solitaire_play script:
    PHP Code:
    function released(a){
    if(
    a=="red"){
    this.time_1=this.default_timeout//since it is the next players turn now we reset this.time_1 back to default which is 12 seconds.
    this.timeout_1=setTimeout(this.player_time,1000,0);//timeout_1 stores the timeout so you can call clearTimeout if needed later.
    _root.solitaire.solitaire_play.red_btn.enabled=false
    _root
    .solitaire.solitaire_play.black_btn.enabled=true
    }

    if(
    a=="black"){
    this.time_1=this.default_timeout//since it is the next players turn now we reset this.time_1 back to default which is 12 seconds.
    this.timeout_1=setTimeout(this.player_time,1000,1);//timeout_1 stores the timeout so you can call clearTimeout if needed later.
    _root.solitaire.solitaire_play.red_btn.enabled=true
    _root
    .solitaire.solitaire_play.black_btn.enabled=false
    }

    When ticks reaches 40 in function pick for either card I commented out the timeout to give the next user a turn for red and black since the next turn will be given from a card swipe. :
    PHP Code:
    //this.timeout_1=setTimeout(this.player_time,1000,1);//timeout_1 stores the timeout so you can call clearTimeout if needed later. 


    For black0, black1, black2, black3 etc.. inside the release function for the card:
    PHP Code:
     _parent.released("black"); 
    For red0, red1, red2, red3 etc.. inside the release function for the card:
    PHP Code:
     _parent.released("red"); 
    download solitaire 12
    Last edited by AS3.0; 05-31-2022 at 01:41 PM.

  5. #25
    Senior Member
    Join Date
    May 2016
    Posts
    275
    can you disable drag after dropping the card

    try drag the card again and look at timer ( problem )
    Last edited by kofa; 05-31-2022 at 02:22 PM.

  6. #26
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,243
    Ok each card that had an internal release function with this call "_parent.released("red");" can have "this" as reference for the card

    PHP Code:
    _parent.released("red",this);  //this is reference to the card in the released function thats in the solitiare_play script 
    so in the solitaire_play script "b" = the card so we can do b.enabled = false to disable it.

    b is "this", reference to the card and it gets disabled from this function
    PHP Code:
    function released(a,b){
    b.enabled=false
    if(a=="red"){
    this.time_1=this.default_timeout//since it is the next players turn now we reset this.time_1 back to default which is 12 seconds.
    this.timeout_1=setTimeout(this.player_time,1000,0);//timeout_1 stores the timeout so you can call clearTimeout if needed later.
    _root.solitaire.solitaire_play.red_btn.enabled=false
    _root
    .solitaire.solitaire_play.black_btn.enabled=true
    }

    if(
    a=="black"){
    this.time_1=this.default_timeout//since it is the next players turn now we reset this.time_1 back to default which is 12 seconds.
    this.timeout_1=setTimeout(this.player_time,1000,1);//timeout_1 stores the timeout so you can call clearTimeout if needed later.
    _root.solitaire.solitaire_play.red_btn.enabled=true
    _root
    .solitaire.solitaire_play.black_btn.enabled=false
    }

    download solitaire 13

  7. #27
    Senior Member
    Join Date
    May 2016
    Posts
    275
    Can you edit after pressing the button the timing starts not after dropping the card
    Last edited by kofa; 05-31-2022 at 03:44 PM.

  8. #28
    Client Software Programmer AS3.0's Avatar
    Join Date
    Apr 2011
    Posts
    1,243
    1.) Click to play.
    2.) Time starts for random card.
    3.) Card makes move.
    4.) Card swipes up.
    5.) Text tells the next person to go, no timer until next person clicks card.

    Or did you expect :

    1.) Click to play.
    2.) Text tells the person to go, no timer until card gets clicked.
    3.) Player clicks his card.
    4.) Player swipes up.
    5.) Text tells the next person to go, no timer until next person clicks card.

    download solitiare 14

    I left my job so I will be programming more lately but I need to make a batch of 3D Android games to sell.
    Last edited by AS3.0; 06-15-2022 at 03:33 PM.

  9. #29
    Senior Member
    Join Date
    May 2016
    Posts
    275
    1.) Click to play.
    2.) Text tells the person to go, no timer until card gets clicked.
    3.) Player clicks his button ( red or black ).
    4.) Timing starts
    5.) Player drag and drop his card. ( if timing end before drag and drop ==> the next player start and ready to click his button , no timer start until click button )
    6.) Player swipes up.
    7.) Text tells the next person to go, no timer until next person clicks card.

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