The original coin-op Pac-Man divided up the playing area into a grid of 28x31 boxes. This concept fits perfectly on the Smartmatrix, leaving room on either side for extra lives, and score (in binary).
Writing something like this yourself is an excellent coding exercise. The logic rules for the game are pretty simple, but there are a lot of them. As everything comes together the complexity builds and it becomes a challenging, yet rewarding exercise.
I wrote a blog post about this project which talks quite a bit more about the hardware. I also made a video to show off the game:
Hardware setup is pretty simple. Follow the assembly instruction that Louis posted. I'm not sure what I plan to do in the future, so I used the surface-mount pads on the back of the Teensy for the Atari Joystick. I used a ribbon cable, and instead of soldering the Teensy in place i used my own pin sockets. There are actually enough extra breakout pads on the back for two joysticks and I may write some head-to-head games in the future.
The Atari joystick uses a standard DB9 connector, which I soldered at the other end of the ribbon cable. I'm limiting the display brightness to 50% (which is still really bright) which keeps this application's current draw below 2A. That makes it possible to power the game with an external cellphone battery so I've connected a USB cable to the terminals on the LED module.
Future Improvements:
- Animation when player is eaten by enemy
- Pause between starting the level over or starting new level
- Display score in decimal when game over
- Add High Score screen and initial entry
- Audio (this has to happen!)
I've been trying to get this to work with several Arduino IDE versions. The 1.6.3 version is not recognised by the Teensy installer, so I tried some other versions that are.
I keep on getting this error when I try to compile the sketch:
matrixman:33: error: 'matrix' was not declared in this scope
matrix.swapBuffers();
'SmartMatrix' does not name a type
I'm not much of a programmer, and I'm currently not able to wrap my head around it (even though it looks simple): what am I doing wrong?