A 2D endless runner game inspired by Google Chrome's offline T-Rex game, built from scratch using C++ and the Qt framework. This was developed as a mini-project for my Advanced Programming (AP) course during the second semester of my Computer Engineering degree.
Dino-video.mp4
- Classic Gameplay: Run and jump to avoid obstacles for as long as you can.
- Dynamic Scenery: The ground scrolls, and clouds move across the sky to create a sense of motion.
- Random Obstacle Generation: Cacti are spawned at random intervals to keep the gameplay challenging.
- Live Score Tracking: Your score is displayed in the top-left corner and updates in real-time.
- Collision Detection: The game accurately detects when the player hits an obstacle and triggers the game-over state.
- Pixel-Art Graphics: Uses custom pixel-art assets for the dinosaur, obstacles, and background elements.
This project was built entirely in C++ using the Qt 6 (or 5) framework. It relies heavily on Qt's Graphics View Framework for efficient 2D rendering.
- Language: C++
- Framework: Qt
- Build System: qmake (
.profile) - Core Qt Modules:
QtWidgets,QGraphicsScene,QTimer,QtGui
The project follows an Object-Oriented design, with key components separated into their own classes:
MainWindow: The main application window that houses the graphics scene and UI elements like the score label.Dinasor: Represents the player character. Manages jumping logic and collision detection.Cactus: Represents the enemy obstacles that are spawned on the screen.Cloud: Manages the decorative cloud sprites that drift in the background.Ground: Manages the scrolling ground lines to create the illusion of movement.
To compile and run this project on your local machine, you will need to have the Qt development tools installed.
- A C++ compiler (like GCC, Clang, or MSVC)
- The Qt Framework (Open Source) - Make sure to install a desktop kit (e.g., MinGW, MSVC, or GCC).
-
Clone the repository:
git clone [https://github.com/ALISHA8484/Dino-mini-game.git]
-
Navigate to the project directory:
cd Dino-minigame -
Build and run using Qt Creator:
- Open the
Dino-minigame.profile in Qt Creator. - Configure the project with a valid Qt Kit.
- Click the green "Run" button (or press
Ctrl+R).
- Open the
- Launch the game.
- Press the Spacebar to make the dinosaur jump over the cacti.
- The game ends when you collide with a cactus.
- Survive as long as you can to get the highest score!
This project is open-source and available under the MIT License. See the LICENSE file for more details.