Skip to content

sunkuangdong/GoldGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿช™ Gold Game - Qt Coin Flip Puzzle

Qt C++ CMake Platform

A sophisticated cross-platform puzzle game built with Qt/C++, featuring elegant UI design, smooth animations, and challenging gameplay mechanics. Players must strategically flip coins to achieve uniform orientation across a 4ร—4 grid.

๐ŸŽฎ โ–ถ๏ธ Download & Play Now - Ready to run on Windows, no installation required!

โœจ Features

๐ŸŽฎ Core Gameplay

  • 20 Progressive Levels with increasing difficulty
  • 4ร—4 Grid System with strategic coin-flipping mechanics
  • Chain Reaction Logic - clicking a coin affects adjacent coins
  • Win Condition Detection with smooth victory animations

๐ŸŽจ User Interface

  • Multi-Scene Architecture (Main Menu โ†’ Level Selection โ†’ Gameplay)
  • Custom Widget Components with hover effects and animations
  • Responsive Design optimized for 320ร—588 resolution
  • Intuitive Navigation with back button functionality

๐Ÿ”Š Multimedia Integration

  • Immersive Audio System with sound effects for interactions
  • High-Quality Graphics with coin flip animations
  • Resource Management through Qt Resource System
  • Smooth Transitions between game states

๐Ÿ› ๏ธ Technical Excellence

  • Object-Oriented Architecture with custom classes (MyCoin, MyPushButton)
  • Event-Driven Programming with Qt signal-slot mechanism
  • Memory Management with proper cleanup and deletion
  • Cross-Platform Compatibility via CMake build system

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   MainScene     โ”‚โ”€โ”€โ”€โ–ถโ”‚ ChooseLevelScene โ”‚โ”€โ”€โ”€โ–ถโ”‚   PlayScene     โ”‚
โ”‚  (Entry Point)  โ”‚    โ”‚  (Level Grid)    โ”‚    โ”‚ (Game Logic)    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚                        โ”‚                       โ”‚
         โ–ผ                        โ–ผ                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ MyPushButton    โ”‚    โ”‚   Custom UI      โ”‚    โ”‚    MyCoin       โ”‚
โ”‚ (Interactions)  โ”‚    โ”‚   Components     โ”‚    โ”‚ (Game Entity)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

Option 1: Download & Play (Windows) ๐ŸŽฎ

For immediate gameplay:

  1. Download the game

    git clone https://github.com/sunkuangdong/GoldGame_zip.git
    cd GoldGame_zip
  2. Run the game

    # Double-click CoinFilp.exe or run from command line
    ./CoinFilp.exe

Option 2: Build from Source ๐Ÿ› ๏ธ

For development or other platforms:

Prerequisites

  • Qt 5.12+ or Qt 6.x
  • CMake 3.16+
  • C++17 compatible compiler
  • Git (for cloning)

Installation

  1. Clone the repository

    git clone https://github.com/sunkuangdong/GoldGame.git
    cd GoldGame
  2. Create build directory

    mkdir build && cd build
  3. Configure with CMake

    cmake .. -DCMAKE_BUILD_TYPE=Release
  4. Build the project

    cmake --build . --config Release
  5. Run the game

    ./CoinFilp        # Linux/macOS
    CoinFilp.exe      # Windows

Alternative: Qt Creator

  1. Open CMakeLists.txt in Qt Creator
  2. Configure kit and build directory
  3. Build and run the project

๐ŸŽฏ How to Play

  1. Start the Game - Launch from the main menu
  2. Select Level - Choose from 20 available levels (1-20)
  3. Flip Strategy - Click coins to flip them and adjacent coins
  4. Win Condition - Turn all coins to show the same side (heads)
  5. Progress - Complete levels to unlock new challenges

Game Rules

  • Clicking a coin flips it and its four adjacent coins (up, down, left, right)
  • Diagonal coins are not affected
  • Edge and corner coins have fewer adjacent coins
  • Strategic thinking required to solve puzzles efficiently

๐Ÿ“ Project Structure

GoldGame/
โ”œโ”€โ”€ ๐Ÿ“„ main.cpp                # Application entry point
โ”œโ”€โ”€ ๐Ÿ“„ mainscene.{h,cpp,ui}    # Main menu scene
โ”œโ”€โ”€ ๐Ÿ“„ chooselevelscene.{h,cpp} # Level selection scene
โ”œโ”€โ”€ ๐Ÿ“„ playscene.{h,cpp}       # Gameplay scene
โ”œโ”€โ”€ ๐Ÿ“„ mycoin.{h,cpp}          # Coin widget implementation
โ”œโ”€โ”€ ๐Ÿ“„ mypushbutton.{h,cpp}    # Custom button widget
โ”œโ”€โ”€ ๐Ÿ“„ dataconfig.{h,cpp}      # Level data configuration
โ”œโ”€โ”€ ๐Ÿ“ res/                    # Game resources
โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ *.png              # UI graphics and sprites
โ”‚   โ”œโ”€โ”€ ๐Ÿ”Š *.wav              # Audio files
โ”‚   โ””โ”€โ”€ res.qrc               # Qt resource file
โ”œโ”€โ”€ ๐Ÿ“ build/                  # Build artifacts
โ”œโ”€โ”€ ๐Ÿ“„ CMakeLists.txt          # Build configuration
โ””โ”€โ”€ ๐Ÿ“„ README.md               # Project documentation

๐Ÿ”ง Development

Code Style

  • Modern C++17 features and best practices
  • Qt conventions for signal-slot connections
  • RAII for resource management
  • Const-correctness where applicable

Key Components

MyCoin Class

class MyCoin : public QPushButton {
    Q_OBJECT
public:
    MyCoin(QString imgPath);
    void changeFlag();           // Flip coin state
    bool flag;                   // Current coin state
    int posX, posY;             // Grid position
    bool isAnimation;           // Animation state
    bool isWin;                 // Win condition flag
};

PlayScene Logic

  • Grid Management: 4ร—4 array tracking coin states
  • Click Handling: Processes coin interactions
  • Win Detection: Checks victory conditions
  • Animation System: Smooth transitions and effects

Building from Source

Debug Build:

cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . --config Debug

Release Build:

cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.

Development Guidelines

  1. Follow the existing code style and conventions
  2. Write clear commit messages
  3. Test your changes thoroughly
  4. Update documentation as needed

๐Ÿ“„ License

This project is open source and available under the MIT License.

๐Ÿ”— Links

๐Ÿ“‚ Repository Structure

This project is organized across two GitHub repositories:

  • ๐Ÿ“ฆ GoldGame - Complete source code, development files, and documentation
  • ๐ŸŽฎ GoldGame_zip - Pre-built Windows executable with all dependencies

๐Ÿ“ง Contact

Developer: sunkuangdong
GitHub: @sunkuangdong


Built with โค๏ธ using Qt and C++

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages