This project have been made for me to learn C
and SDL2
library.
To compile the project, you need to have SDL2
and SDL2_image
installed on your computer.
Then, you can compile the project with the following command:
cd src
make
This will create a pacman
executable in the bin
folder.
To run the game, you can use the following command:
cd bin
chmod +x pacman
./pacman
To clean the project, you can use the following command:
cd src
make clean
This will remove all the .o
files and the pacman
executable.
- Custom level file format (see Leveling)
- Custom tileset file format (see tileset.png)
- Custom font file format (see font.ttf) (note that the default font is Open Sans Regular from Google Fonts)
- Sprite animation (ghosts and pacman) :
- Ghost AI (Blinky, Pinky, Inky and Clyde)
- Bonus (cherry, strawberry, orange, apple) (see Bonus)
You can create your own level by editing level.txt
file in the data
folder.
All the tiles are defined in the tileset.png file.
Here is the list of all the tiles:
Note that the tileset is composed of 32x32 tiles.
Note also that you have multiple walls types (see tileset.png). You have a wall type that is taken the 2/3 of the tile and another one that is taken the 1/3 of the tile, the last one is centered in the tile.
The ghosts are controlled by a random algorithm. The ghosts can move in 4 directions (up, down, left and right). The ghosts can't move in the opposite direction of their current direction.
Ghost | Color | Sprite |
---|---|---|
Blinky | Red | |
Pinky | Pink | |
Inky | Cyan | |
Clyde | Orange | |
Scared ghost | White / Blue |
The bonus will appear at a random interval of time and have a random position on the map. The bonus will disappear after a certain amount of time. Then the bonus will automatically reappear at a random interval of time and have a random position on the map.
Pacman is controlled by the player. The player can move in 4 directions (up, down, left and right).
The player goal is to eat all the dots and the bonus. The player can eat the ghosts after eating a big dot (the ghosts will be scared for a certain amount of time).
Key | Action |
---|---|
arrow up |
Move up |
arrow down |
Move down |
arrow left |
Move left |
arrow right |
Move right |
space |
Start the game |
escape |
Pause the game |
lctrl + f |
Toggle FPS |
lalt + f4 |
Quit the game |
lctrl + r |
Restart the game |
enter |
Validate action |
Start screen
Game screen
Pause screen
Ghosts scared
Bonus
Game over screen
Feel free to contribute to this project by forking it and making a pull request.
If you find any bug or have any suggestion to improve the project, please open an issue.
You will find a list of things that I would like to add or fix in the TODO file.
This project is licensed under the MIT License - see the LICENSE file for details
- Hokanosekai - Initial work