-
Notifications
You must be signed in to change notification settings - Fork 1
Home
A clone of the old game Pac-Man with some additional changes written in C for Windows. This project was created for a university assignment.
Even after 44 years since its first release, Pac-Man is still fun to play. Many developers these days attempt to recreate it using various tools and languages because the game is neither simple nor difficult. In our attempt, we managed to write Pac-Man in C that works on consoles, i.e. everything is in plain text. This made it harder to implement the movement of entities because they could be positioned only at one tile at a time. Note that all game mechanics and functional details in the game are taken from this dossier, you can look it up if you do not know how the original game works.
The game starts with a little window greeting the player. The text slowly fills in and later it asks for a key press. Pressing Enter
takes the player to the main menu. A short animation is performed before the main menu is listed. A big sign at the top of the screen displays the game title with a short animation using a "sliding window" effect and a loading bar below. Note that we make extensive use of box-drawing characters to draw grids and borders, ANSI escape codes to manipulate foreground colors, background colors, and text styles, and Unicode emojis to represent various objects.
All menus generally list all the options and actions you can perform with their brief descriptions. One important nuance is that the player needs to enter options as plain texts, while some might expect it to listen for key presses. For consistency reasons, we have grouped texts into four categories in terms of their purpose:
-
#
- Preceeds a comment or a block of info. -
>
- Preceeds a prompt and then user input. -
~
- Preceeds a warning message. -
!
- Preceeds an error message.
Different texts will also be colored differently:
Type | Color |
---|---|
Comments | #82AAFF |
Prompt & Input | #89DDFF |
Warning | #4EC9B0 |
Error | #FF6666 |
Number | #EB7669 |
Option | #FFCB6B |
The program will try to validate every possible user input and print an error message in case of a failure; users can re-enter their input after an error. Inputs are parsed case-insensitively, i.e. it does not matter whether a
or A
is entered. Prompts that require multiple arguments use white-space characters as delimiters (except for newline characters); additionally, all extra characters are trimmed and ignored. Below you can see a list of all options in the main menu (#
), a prompt for the user (>
), and a series of error messages for different reasons (!
):
There was only one blue map to play in in the original game. Therefore, we added four new maps to add a little more variety. To unlock the next level, the player has to reach a certain score in the previous level. This page showcases all five levels, their colors, and the amount of score required to unlock them. The player can switch between levels with the option L
and see their highest scores for every level with the option H
.
The game starts as soon as the player enters S
as an option. As it is in the original game, the objective is to eat all the dots and advance to the next round. Higher rounds affect the type of randomly spawning fruits and ghosts become faster and more aggressive. Scores earned in each round accumulate until the Pac-Man loses all three of his lives, after which the game ends. At the top of the screen, the current level, rounds, accumulated score, and remaining lives are shown. Ghosts are drawn with red, orange, purple, and blue circle emojis. Each ghost has a unique movement pattern and their behavior is implemented in exactly the same way as it is written in the dossier. Eating a power-up temporarily weakens ghosts and at this stage, Pac-Man can eat ghosts as well, granting up to 1600 points of score. After a certain amount of time throughout the game, a fruit granting bonus points spawns in the middle of the map and despawns when the timer runs out. The player can press Shift + R
to restart or Shift + Esc
to end the game.
After having some fun and enjoying the game, the player can exit the game from the main menu with the option Q
.