Stuck at some logic/math regarding card game.
OptimisticMind
Member Posts: 4
Greetings to the great community of gamesalad! I have been searching the forums for information regarding my problem this past days but to no avail.
I am making a card match memory game and im stuck in the logic(and some script/math). I bought tshirtbooths #2 template and it was great but i kinda lost him when it came to some points.
Firstly, i would like to know if its possible to create a game with multiple actors as the cards and no tables.
Secondly, i am stuck at the card flip part of it. I want to understand how to make the card display its "back" and not the icon when playing. I want it to show the "back of the card" and upon clicking, flip and show the icon/value.
Tshirtbooths template is great, but i just lost him when it came to the flipping of actor and the display of the "cardback".
I appreciate any kind of help, either logic or math ! Thank you in advance.
-Jason
I am making a card match memory game and im stuck in the logic(and some script/math). I bought tshirtbooths #2 template and it was great but i kinda lost him when it came to some points.
Firstly, i would like to know if its possible to create a game with multiple actors as the cards and no tables.
Secondly, i am stuck at the card flip part of it. I want to understand how to make the card display its "back" and not the icon when playing. I want it to show the "back of the card" and upon clicking, flip and show the icon/value.
Tshirtbooths template is great, but i just lost him when it came to the flipping of actor and the display of the "cardback".
I appreciate any kind of help, either logic or math ! Thank you in advance.
-Jason
Comments
When Touch is Pressed
.....When [attribute] game.CardsSelected=0
..........Change Attribute game.FirstSelectedCard (text) to self.Name [or some other unique attribute such as self.Image if you prefer]
..........Change Attribute game.CardsSelected to game.CardsSelected+1
.....When [attribute] game.CardsSelected=1
..........Change Attribute game.SecondSelectedCard to self.Name
..........Change Attribute game.CardsSelected to game.CardsSelected+1
When [attribute] game.CardsSelected=2
.....When [attribute] game.FirstSelectedCard=game.SecondSelectedCard
.....[it's a match!]
.....Otherwise
..........[nope!]
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
If im not asking much, and if i do please excuse me, how can i get the cards to display passively their "back" and upon flip! In tshirtbooths template, he used "change attribute self.image to " but when i do that, nothing happens.
Thanks! ^^
I haven't used that template so I can't really comment on it, but if you want to post the rules you're trying I can see if I can help further.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
. . . hold on, let me do you a quick demo:
http://www.mediafire.com/?z96j44l2299926k
Ultimately the only real reason the 'done' switch is there is because I wanted to be able to drag the mouse across the cards to flip them because it looked real pretty ! :o3 Two images called '0' and '1'.
self.image starts out as 1.
1-self.image . . . translates as: 1-1 = 0
self.image is now 0.
1-0 = 1
self.image is now 1.
1-1 = 0
self.image is now 0.
1-0 = 1
self.image is now 1.
1-1 = 0
self.image is now 0.
1-0 = 1
self.image is now 1.
. . . . . etc, basically if you keep taking away 1 from the result of the sum '1-X' (and X starts as either 1 or 0) then it will go: 1010101010101010101010101 = card flip !!
Made 1 actor with cherry and 1 with a clove with a display text behavior to confirm that its working properly but when i click on one of the two pics, all of the images display their text instead of just the two. Maybe its the text attribute where i store the selected cards's "image" because when i want to compare the two, i can only use "contain" (due to being a text attribute) Eg "change game.first selected card to self.image".
Thanks socks ! Great way to start my sunday haha!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Did you get to finish the Card Match Game you were making? I want to make one too for an event I'm planning but there's not a lot of tutorials on checking for matches, flipping cards and back, and pretty much everything needed to create such a game.
I'd appreciate anything you can share on this.
I could do copy/paste with templates, but learning the principle is much better.
There is a saying that goes, "Give a man a fish and you feed him for a day, but teach him how to fish and you feed him for a lifetime."