MatchingCardsGame

๐Ÿƒ Matching Cards Game

A Java Swing-based Memory Matching Game where players flip cards to find matching pairs before time runs out.


๐Ÿ“Œ Overview

Matching Cards Game is a desktop GUI application built using Java Swing.

Game Rules:


๐ŸŽฎ Gameplay Flow

  1. All cards are shown face-up for 5 seconds.
  2. Cards automatically flip face-down.
  3. Player clicks two cards:
    • โœ… If they match โ†’ They stay revealed & score increases.
    • โŒ If they donโ€™t match โ†’ They flip back.
  4. Game ends when:
    • Time reaches zero, or
    • All pairs are matched.

๐Ÿ›  Technologies Used


๐Ÿ“‚ Project Structure

MatchingCardsGame/
โ”‚
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ MatchingCardsGame.java
โ”‚ โ”œโ”€โ”€ game.java
โ”‚ โ”œโ”€โ”€ card.java
โ”‚ โ”œโ”€โ”€ CardClickListener.java
โ”‚ โ””โ”€โ”€ pane.java
โ”‚
โ”œโ”€โ”€ Images/
โ”‚ โ”œโ”€โ”€ (24 card images)
โ”‚ โ””โ”€โ”€ unknown.png
โ”‚
โ”œโ”€โ”€ matched.png
โ”œโ”€โ”€ unmatched.png
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ .gitignore
โ””โ”€โ”€ README.md

๐Ÿ–ผ Images Directory

The Images/ folder contains:

โš ๏ธ Image file names must match the names used inside the code.


๐Ÿง  Core Components

๐Ÿ”น MatchingCardsGame


๐Ÿ”น game


๐Ÿ”น card


๐Ÿ”น CardClickListener

Controls card click behavior:


๐Ÿ”น pane

Displays:

Ends the game when time reaches zero.


โ–ถ๏ธ How to Run the Project

1๏ธโƒฃ Requirements

2๏ธโƒฃ Compile

From the project root:

cd src
javac *.java

3๏ธโƒฃ Run

java MatchingCardsGame

๐Ÿ“ธ Screenshots

โœ… Match Example

โŒ Unmatched Example


๐ŸŽฏ Features


๐Ÿš€ Possible Improvements


๐Ÿ‘จโ€๐Ÿ’ป Author

Developed by Ayman Soliman

GitHub: Ayman Soliman


๐Ÿ“œ License

This project is licensed under the terms described in the LICENSE file.