This is a simple implementation of the classic Pacman game using C and OpenGL. The game features basic gameplay mechanics, including Pacman moving through a maze, collecting points, and avoiding ghosts.
- Pacman can move in four directions: up, down, left, and right.
- Ghosts move around the maze and try to catch Pacman.
- Pacman can collect points and power-ups.
- The game includes a start screen and a game over screen.
- GCC (GNU Compiler Collection)
- OpenGL
- GLFW
- SOIL (Simple OpenGL Image Library)
On Ubuntu, you don't need to manually download and place header files in /usr/include. Instead, use the package manager (apt) to install the required development packages, which ensures that all headers and related libraries are correctly placed in system directories.
Before installing the necessary libraries, update your package list and install essential build tools:
sudo apt-get update
sudo apt-get install build-essentialThis installs compilers and tools required for compiling C/C++ programs.
The OpenGL headers (GL/gl.h) and GLU (GL/glu.h) are provided by the Mesa package. Install them using:
sudo apt-get install libgl1-mesa-dev libglu1-mesa-devThese packages ensure OpenGL and GLU headers and libraries are installed in /usr/include/GL.
GLFW (GLFW/glfw3.h) is needed for OpenGL windowing. Install it with:
sudo apt-get install libglfw3-devThis places GLFW headers in the system include paths.
The SOIL (Simple OpenGL Image Library) headers (SOIL/SOIL.h) can be installed using:
sudo apt-get install libsoil-devThis ensures SOIL headers and libraries are properly installed.
To confirm that the headers are correctly installed, you can check their locations:
ls /usr/include/GL # OpenGL headers
ls /usr/include/GLFW # GLFW headers
ls /usr/include/SOIL # SOIL headers-
Clone the repository:
git clone https://github.com/yourusername/Pacman_C.git cd Pacman_C -
Build the project using the provided Makefile:
make
-
Run the game:
make run
-
Use the arrow keys to move Pacman:
- Right arrow: Move right
- Down arrow: Move down
- Left arrow: Move left
- Up arrow: Move up
-
Press
Pto start the game from the start screen. -
Press
ESCto exit the game.
main.c: Contains the main game loop and initialization code.Pacman.c: Contains the implementation of Pacman, ghosts, and the game scenario.Pacman.h: Header file with function declarations and data structures.Makefile: Build script to compile the project.
- Used open source assets in github.
- The game uses the Simple OpenGL Image Library (SOIL) for loading textures.
- The game is inspired by the classic Pacman game developed by Namco.

