How do I compare more than 2 instances in a card game

0 favourites
  • 3 posts
From the Asset Store
Template for trading card game, fully documented in comments and video
  • hi,im new to programming and learning about construct

    i'm practising with a card game like buracco style

    i want to click cards already on player hand,the first group should be 3 cards and ordered by value and suite and move them to another position if that happens

    i have already set variables on each instance card with facevalue and cardsuite and set the value and suite of each card clicked on a array

    some tips on how to compare cards to be ordered before you can move them ?

    i'm searching forums every day while practising what i found but there are few card games posts..

    sorry for my english im spanish

    if someone is interested in making the game with me tell me

    im using rexrainbow plugins and behaviors on the capx thank you in advance

  • Check if 3 cards are selected

    Check all face values are the same

    Add all selected cards values to an array

    Sort the array (it will put cards in ascending order)

    Check that card in index 1 is greater than card in index 0 by 1 and lower than card in index 2 by 1

    If all that is true, position the cards close to one another in order and position pin them together

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Check if 3 cards are selected

    Check all face values are the same

    Add all selected cards values to an array

    Sort the array (it will put cards in ascending order)

    Check that card in index 1 is greater than card in index 0 by 1 and lower than card in index 2 by 1

    If all that is true, position the cards close to one another in order and position pin them together

    hi and thnx for reply

    when u say Check all face values are the same u mean check all card suite is the same?

    i didnt explain correctly first post, i want to make straights of same card suite ex: 1clover-2clover-3clover...kingclover and the first time you set cards on x position they have to be at least 3 ex: 4clover-5clover-6clover and then you and player playing with you can set more cards of that suite.

    how can i ckeck if all clicked and set as clicked variable are from same suite?compare variable deck- cardsuite = deck.cardsuite?

    and how i can check an index value at position x when i pick more than 3?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)