https://github.com/yayuniversal/homemade-pacman
Homemade Pacman with C++ and OpenGL
https://github.com/yayuniversal/homemade-pacman
cpp opengl pacman
Last synced: about 2 months ago
JSON representation
Homemade Pacman with C++ and OpenGL
- Host: GitHub
- URL: https://github.com/yayuniversal/homemade-pacman
- Owner: yayuniversal
- Created: 2021-10-15T23:26:17.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-10-17T21:45:43.000Z (over 4 years ago)
- Last Synced: 2025-01-08T16:25:06.453Z (over 1 year ago)
- Topics: cpp, opengl, pacman
- Language: C
- Homepage:
- Size: 274 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Homemade Pacman
Homemade Pacman with C++ and OpenGL

## Clone
Clone the repository with the `recurse-submodules` option to clone the libraries repositories as well:
```
git clone --recurse-submodules https://github.com/lilianmallardeau/Homemade-Pacman.git
```
Then move to the cloned folder.
## Build and run
```
mkdir build
cd build
cmake ..
make
cd ..
./build/Homemade_Pacman levels/level0
```
To run, the current working directory **MUST** be the root folder of the repository, because the program has to load the shaders files in the `src/shaders/` folder and the texture in the `assets/` folder.
## Changing the game options
Some game options can be changed in the `src/parameters.h` header file. Although their name is already kind of explicit, here is a brief description of each of them:
| Parameter | Description |
|:---------:|:-----------:|
| `FULLSCREEN` | 1 to enable fullscreen, 0 otherwise |
| `SCALE` | Initial size of each map unit, in pixels. Ignored if `FULSCREEN` is set to 1. |
| `PACMAN_SPEED` | Pacman movement at each frame, as a float[^1] |
| `GHOSTS_SPEED` | Ghosts movement at each frame, as a float[^1] |
| `GHOSTS_NUMBER` | Number of ghosts |
| `MIN_GHOST_INIT_DISTANCE` | Minimum distance between Pacman and the generated ghosts |
| `GHOSTS_ANIMATION_SPEED` | Delay in sec. between each sprite change for the ghosts |
| `PACMAN_ANIMATION_SPEED` | Delay in sec. between each sprite change for Pacman |
| `BACKGROUND_COLOR` | RGB background color |
| `WALLS_COLOR` | RGB walls color |
| `TUNNEL_COLOR` | RGB tunnels color |
| `PELLETS_COLOR` | RGB pellets color |
[^1]: The size of each map square is 1, ie. a speed of 1 will make pacman or the ghosts move of 1 square at each frame update (which is pretty fast 😅)
## TODOs
- [ ] Make the texture and the shader for `MovableEntities` static to avoid creating one for each entity
- [ ] Use smart pointers
- [ ] Use delta time instead of render loop to update the movement of the entities, to make the speed of the game independent of the system