profile picture
profile picture for mobile

JORDAN HOOK

SOFTWARE DEVELOPER

Pacman Game

Category: Desktop Application (C#)


In 2013, near the end of high school I decided to write another game in C# using GDI+ (I made this game using school computers which did not support available game engines as the time and thus my choice for GDI+). I am posting this project due to it being commented very nicely and it provide a base for those of you looking to make a simple C# game using GDI+.

The game is completely drawn in GDI+ using shapes and lines except for the ghost npcs in which are images that drawn.

This game provides a basic game loop in which floors the following order of events:

while (true)
{
                //Stop the program from freezing
                Application.DoEvents();

                //If the player collected all the food / balls then trigger a win event 
                if (playerScore == 1810)
                {
                    //Tell the player he won 
                    Cursor.Show();
                    MessageBox.Show("YOU WIN!");

                    //Kill thep process (I was lazy and used infinite loops)
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }

                //Limit Frames?
                //if (intTick < 30)
                //{
                //    Thread.Sleep(10);
                //}

                //Draw the next frame 
                DrawGame();
                
                //Update the Frames Per Second
                CheckFPS();
}

Due the project being an older programming projec, not all of the best programming practices were followed however it's not a horrible project.

Here's a screen shot of the game:

Pacman:

I have also prepared a short GIF of the game in action, please see below:

Game Play:

The coolest part about this game is that actually includes sound effects when pacman eats food or when he is killed by ghost.

If you are interested in the source or trying out the game, please see the github link below!

Pacman Game - Github