This project is a reimagined version of the classic Chrome Dinosaur game, developed using Python and OpenGL. The game leverages shader matrices and algebraic operations to perform movements like scaling, translation, and rotation, optimizing graphic performance.
- Python 3.x
- OpenGL (PyOpenGL)
- Pygame (for window management and input handling)
- NumPy (for matrix operations)
- GLSL Shaders (for rendering)
Ensure you have the following installed:
- Python 3.x
- pip (Python package installer)
-
Clone the Repository
git clone https://github.com/yourusername/dinosaur-opengl-game.git cd dinosaur-opengl-game -
Create a Virtual Environment (Optional but Recommended)
python -m venv venv # Activate the virtual environment: # On Windows: venv\Scripts\activate # On macOS/Linux: source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
If
requirements.txtis not provided, install dependencies manually:pip install pygame PyOpenGL numpy
Execute the main.py script:
python main.py- Jump:
Space - Double Jump & Flip: Press
Spaceagain while in the air. - Grow Dinosaur:
O - Shrink Dinosaur:
P - Throw Fireball:
F
- Dinosaur Movements:
- The dinosaur can perform a double jump, with the second jump initiating a flip.
- The size of the dinosaur can be adjusted in real-time.
- Obstacles:
- Cacti appear on the ground.
- Birds fly at a higher altitude and can be destroyed with fireballs.
- Fireballs:
- Grow in size over time.
- Eliminate birds upon collision.
- Objective:
- Avoid obstacles and survive as long as possible.
- Matrix Operations:
- Used for all graphical transformations to optimize performance.
- Includes scaling, translation, and rotation matrices.
- Shaders:
- Vertex Shader: Handles vertex transformations.
- Fragment Shader: Manages pixel coloring.
- Event Handling:
- Captures keyboard inputs for controlling the dinosaur.
- Updating Game State:
- Updates positions and states of all game objects.
- Rendering:
- Draws all game objects using OpenGL calls.
This project is licensed under the GPL License. See the LICENSE file for details.
- Inspired by the classic Chrome Dinosaur game.
- Utilized resources from the OpenGL and Pygame communities.
Feel free to reach out if you have any questions or suggestions.
