Results 1 to 2 of 2
Thread: Matching Game
- 10-07-2012, 01:44 PM #1
Member
- Join Date
- Oct 2012
- Posts
- 1
- Rep Power
- 0
Matching Game
I'm a begginer in java. and I'm doing a Matching/Memory Game in JCreator using buttons and if-else statements.

It's just the typical Matching/Memory Game. When you click the buttons, the image clicked will pop up then if you click the next one, but it's not the same image, then both will close. If you get the correct matching image, they both disable. My problem is the logic of matching it.
What will I do or use to make my program know that two buttons match?
I hope someone is getting what i mean here :(
This is how it looks when the buttons are clicked. New game button is working too. It reverts back to the closed buttons.

I really need help with this asap! This is my assignment, to be passed this tuesday.
I'll be really grateful if someone could help me!
-
Re: Matching Game
One way to get this to work is to use ImageIcons. Note that two buttons can share the same ImageIcon, and so you could distribute 8 pairs of ImageIcons to the 16 buttons, and then compare ImageIcons with the equals(...) method.
Myself when I've done this, I've separated the game logic from the GUI, and created a "model" with buttons, that could be compared to see if they were equal, but this is not necessary if you're creating this game.
Similar Threads
-
Problem with Memory Matching Game
By thesonyuh in forum New To JavaReplies: 6Last Post: 09-24-2011, 04:59 AM -
Matching picture game in java
By iswan in forum New To JavaReplies: 1Last Post: 09-08-2011, 02:02 AM -
Need help with matching game
By soundymcsoundsound in forum New To JavaReplies: 2Last Post: 11-02-2010, 11:09 PM -
Picture Matching Game
By schnappi in forum AWT / SwingReplies: 3Last Post: 08-09-2009, 01:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks