Memory Match Game

I have done the best I could with searching this site, forum and the general internet.

I hope this is easier then I think.

I want to build a card matching game that works like so:
(totally predictable, I know)

  1. X amount of cards are spread out on screen in random order
  2. user taps a card, value is revealed
  3. user clicks another card, value is revealed
  4. if the two match, the cards are destroyed
  5. if they cards don’t match, they flip back to their original image.
    I have tried this using Sprites, Animations, replacing the image.

There has to be a smarter way to accomplish this.

[code]
tiles = {“cardFront.png”, “cardBack.png”}

local t1 = movieclip.newAnim( tiles )
local t2 = movieclip.newAnim( tiles )

a1 = false
a2 = false

totalFlipped = 0
matches = 0

local function flip_a1()
t1:nextFrame()
a1 = true
totalFlipped = totalFlipped + 1
–print(totalFlipped)
end
t1:addEventListener( “tap”, flip_a1 )[/code]
Thanks to whomever can lead me in the right direction. [import]uid: 7850 topic_id: 7181 reply_id: 307181[/import]

I’m working on a card-matching game right now – and it’s my first try at something like this so I’m making it work first, and then I’ll go back and optimize things.

So I hesitate to tell you how to do something because I know I’ll be changing things soon. :slight_smile:

In general, I have a table full of objects (could be card faces) that I shuffle at the start of a level. The table actually has 18 different objects twice, for a total of 36 squares.

Then I create 36 display objects, lay them out in a grid, and add a bunch of properties to each object, such as the x and y location of that object, the face value for that object, etc. I also attach an event listener to each object.

When an object is tapped I look to see if it’s the first one tapped in a set. If so, I just “flip it over” by showing whatever I saved in the faceValue property of that object.

When the next tap comes in I see it’s the 2nd of two possible taps so I check for two things – did they tap the first object tapped? If so, I flip it back over. If they tapped a new object I check to see of the faceValue property of that one matches the faceValue property of the one that was already turned over.

If there’s no match I show both cards briefly and then flip them face down and reset some of the counters (such as whether they tapped the first or second card in a set, etc.).

If there is a match, I show both cards briefly, increase the score, remove both objects from the screen, and reset some of the counters.

I keep track of how many matches have been made and when I hit that number I know they’ve completed them all and I can go to the next level, or display the “You won!” message, etc.

I know that’s very vague, but hopefully it will get you started in the right direction. I don’t mind sharing at least some of my code, but not until after I get done pounding it.

Jay
[import]uid: 9440 topic_id: 7181 reply_id: 25612[/import]

I would just like to say that the font on this forum makes it really easy to mis-read “clicks.” [import]uid: 12108 topic_id: 7181 reply_id: 25784[/import]

Heyy …

I haven’t checked this in a while, but have you made any progress on this? [import]uid: 7850 topic_id: 7181 reply_id: 28640[/import]

I have a few more tweaks, but basically Match Game Magic is done. You can see a couple screen shots on this site: http://matchgamemagic.com/

The download links aren’t active because the app hasn’t even been submitted to Apple yet. I hope to do that in just a couple days.

Send me an email (j@jawhye.com) and in a few days I’ll send you some code that may help you.

Jay

Ps - if you sign up at TestFlightApp.com I can put you on the beta list if you want to try it out. Let me know via email and I can send you a sign-up link.
[import]uid: 9440 topic_id: 7181 reply_id: 28643[/import]

great site btw …

found a little type-o

"Match Game Magic won’t cost you anything to pay, it’s a free "

Should read:
"Match Game Magic won’t cost you anything to play , it’s a free " [import]uid: 7850 topic_id: 7181 reply_id: 28658[/import]

Hey friend i have send a e-mail to you ! By the way i`m trying to access the game in app store and i got this message = this iten is not in the USA store ! [import]uid: 13454 topic_id: 7181 reply_id: 28911[/import]