This project aims to practice building a Pac-Man style game using Python.
- The Essencial: to make Pac-Man eat all available pellets, while avoiding collisions with ghosts chasing him.
- Ghosts: Ghosts always start at their home base. All ghosts move toward random direction.
- Game Levels: All levels will be generated based on the map data from the resource files.
- Python
Following packages are required to install the game. Please prepare following packages installed on your machine before the installation. Most recent version is recommended. Tkinter
and Pygame
can be installed using pip
.
- Python 3
- Tkinter
- Pygame
As the product is not using any game framework or engine, the installation process is simple copy and paste.
- Create a directory for the game.
- Copy the product into the new directory.
The map generator will read a map file in /resource
directory. The file name should be level#.txt
or level##.txt
, ##
refers to the number of the level. The file contains 32×32 characters, each character indicates a block/item in the game field.
_
passage (empty)#
wall$
ghost spawn point.
pellet@
Pac-Man (starting point)&
free ghost%
caged ghost
############################
#............##............#
#.####.#####.##.#####.####.#
#.####.#####.##.#####.####.#
#.####.#####.##.#####.####.#
#..........................#
#.####.##.########.##.####.#
#.####.##.########.##.####.#
#......##....##....##......#
######.#####_##_#####.######
######.#####_##_#####.######
######.##____&_____##.######
######.##_###_####_##.######
######.##_###_####_##.######
______.___###$####___.______
######.##_###%####_##.######
######.##_########_##.######
######.##__________##.######
######.##_########_##.######
######.##_########_##.######
#............##............#
#.####.#####.##.#####.####.#
#.####.#####.##.#####.####.#
#...##.......@........##...#
###.##.##.########.##.##.###
###.##.##.########.##.##.###
#......##....##....##......#
#.##########.##.##########.#
#.##########.##.##########.#
#..........................#
############################
############################