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

Get help using Construct 2

Post » Thu Jul 31, 2014 12:03 pm

Message: morspyz is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
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 :)
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 8
Reputation: 600

Post » Fri Aug 01, 2014 4:09 pm

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
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 428
Reputation: 2,337

Post » Fri Aug 01, 2014 7:26 pm

brunopalermo wrote: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?
B
8
S
3
Posts: 8
Reputation: 600


Return to How do I....?

Who is online

Users browsing this forum: evillair, plinkie, YoHoho and 10 guests