This is a Pac-Man game with procedurally generated maps, and two ghost AIs (Blinky (red) and Pinky (pink)). I only made two ghosts due to the obviously small map size. Each ghost has their own 'personality', just like in the real game, so each has a slight AI variance from the other.
Instructions:
Press <Shift> to turn the arcade cabinet on and off. Hold <Z> to see your score (pauses the game). The number of lives you have left is displayed in the far right column (vertical line of yellow dots). When you lose your last life, the final score will be displayed, and you can press <Z> or <X> to start a new game. Eat Power Pellets (flashing pellets in each corner) to be able to kill ghosts for a short time. The ghosts will flee from you during this time, so be quick and use the Power Pellets wisely! Eat all of the pellets and power pellets on the map by visiting every walkable tile to advance to the next level.
Scoring:
Regular pellet: 10 points
Power pellet: 20 points
Ghost kill: 50 points
Tips & tricks:
-
Blinky is always targeting the player directly, so will usually be following behind you. When the player eats a power pellet, Blinky will run to the bottom-left corner of the map.
-
Pinky is always targeting 3 tiles ahead of the player, based on which direction you're facing, so he is always trying to get in front of you. When you eat a power pellet, he will run to the top-right corner.
-
Enemies can never reverse their direction, even if that means taking the long away around an obstacle.
- Enemies always respawn in their respective starting corners shortly after being eaten (I didn't have enough screen space to make a ghost house); after eating a ghost, be mindful of the top corners!
The code is pretty messy, but I'm working on a much better coded engine that's based around this type of game, and will share the engine with everyone so you can make your own Pac-Man-inspired games!
Enjoy, and feedback is always welcomed and encouraged! I don't know if the color scheme is too boring or difficult to see, but due to Pac-Man being yellow, with ghosts being red, pink, and then blue/white when the player is powered up, this limited my color options a bit for the walls and path colors. Paths are always a dark color in these types of games, and walls are always a lighter color than paths, so these are the colors I settled on for now. If you can come up with better colors for the walls and paths, let me know!
Changes:
Version 1.3: Fixed a bug where touching a power pellet and colliding with a ghost at the same time resulted in both consuming the power pellet and dying simultaneously. Now you will correctly become invincible and kill the ghost.
Version 1.2: Buddy of mine thought the cabinet movement was too jarring when you press the directional buttons. I removed that interaction, but you can find the old version below.
Version 1.1: Fixed AI pass-through bug. The problem was that I was checking player->ghost collisions at the end of each update cycle, after both the player and ghosts had moved. I needed to check those collisions after each time a character moved, instead of at the end of the update iteration.
Fixed the bug where you could sometimes pass through ghosts without collisions.
Very nice game! I included it in my compilation video series of the Tiny TV Jam games, if you’d like to take a look :)
Awesome, thanks for checking it out and it's cool that you seemed to like it!
Great sounds design. Really matches the feel of the original.
[Please log in to post a comment]