This website is all about how to program a Pacman game in the Python language using Pygame. In order to get the most out of this site you need to progress through each "level" sequentially. The code in each level builds on the previous levels. In the end you'll have a complete Pacman game.
Made some major updates. I apologize if you're in the middle of the site at this time. I pretty much rewrote the whole code, but I feel the updated code is much better and easier to understand. If you are in the middle of this, then you'll have to start from the beginning again. I know that will deter some of you from finishing, but think of it this way. At least the second time around you should understand everything better right? If it makes you feel better I've started this from scratch at least a dozen times. Here are some of the changes that I made:
If you're new to this site, then you'll want to start your Pacman journey with the "Start" tab above where you'll learn some basics like Vectors and Stacks. You'll then want to progress through each section sequentially. Don't skip any sections because you'll miss important code and your game will break. Each section depends on the previous section.
I understand that this isn't the best or most efficient code in the world. You'll probably scoff at my feeble attempt at programming and come up with a million better ways of doing things. That's fine, you can always drop me a line and brag how much better you are than me, I don't mind because it's probably true. If you do, just explain it in detail because I'd like to be a better programmer.
If you get any errors, then make sure that your tabs are correct since Python is a tabbed language. If you've double checked any spelling mistakes and are still getting errors, then let me know and I'll check it out. I've personally gone through this site many times checking for things that would cause errors, but it's possible to still miss something.
Also, if you feel that any sections are too long or boring and need more explaining or more pictures, then let me know and I'll try and figure out a better way to present the information.
Most of all, enjoy the site for what it is and I just hope you learn something.
For those of you who are interested in having the complete code, here it is. Just download the file below and unzip it. This game was written with Python 3 in mind, so ensure you have Python 3 installed. It will work in Python 2.7 as well, but that may not be the case in future updates.
Assuming you have Python 3 installed as your default Python: To play the game open up a terminal and type 'python run.py'. When the screen opens up press the 'spacebar' to start the game. You can also use the spacebar to pause and un-pause the game. When playing the game, use the directional keys to move Pacman up, down, left, and right.
I of course would still suggest that you go through the site and write the game yourself, but this should allow you to know where any errors have occurred since you'll have a working version. Also maybe playing the game will give you the desire to figure out how it works.
You can change the size of the screen by modifying the TILEWIDTH and TILEHEIGHT variables in the constants.py file. Things work best if you keep those values the same like 16x16 or 34x34 instead of something like 16x32. It will still work, it will just look weird.
*You will also need to make sure that Numpy is installed since some of the code depends on Numpy. I really only use Numpy for a few things, but they do make those few things easier to do.