uLCD Multiplayer Pac-Man

Overview

This program simulates a game of Pac-Man that allows for multiplayer. One player controls Pac-Man, while two other players control a red and yellow ghost using different tactile switches. Tilting the tactile switch moves the controlled character in the corresponding direction (provided it is allowed), and clicking the switch pauses/resumes the game.

Components

Circuitry

mbeduLCD
5V=VU5V
GndGnd
TX=P28RX
RX=P27TX
P30Reset
mbedPac-Man Switch
3.3V=VoutPower(+)
P9Right(R)
P10Down(D)
P11Left(L)
P12Click(C)
P13Up(U)
GndGnd(-)
mbedRed Ghost Switch
3.3V=VoutPower(+)
P14Right(R)
P15Down(D)
P16Left(L)
P17Click(C)
P19Up(U)
GndGnd(-)
mbedYellow Ghost Switch
3.3V=VoutPower(+)
P25Right(R)
P24Down(D)
P23Left(L)
P22Click(C)
P21Up(U)
GndGnd(-)

Gameplay

Pac-Man starts with three lives, and the ghosts have infinite lives. Pac-Man's objective is to eat all of the pac dots before running out of lives. Eating a regular pac dot adds 10 points to Pac-Man's score; eating a big pac dot adds 50 points to Pac-Man's score. The ghosts' objective is to prevent Pac-Man from doing so. If Pac-Man comes into contact with a ghost, he dies and loses a life, causing Pac-Man and both of the ghosts to reset to their original starting positions. If Pac-Man runs out of lives, he loses the game. As a countermeasure to the ghosts, the big pac dots are used as power-ups. The power-ups allow Pac-Man to be invincible for a fixed amount of time, during which Pac-Man can also eat the ghosts and force them to reset. During each power-up period, the first ghost Pac-Man eats adds 200 points to Pac-Man's score, the second adds 400 points, the third adds 600 points, and so on. The Ghosts change color to blue when a power-up is eaten and revert back to their original colors when the power-up effect is gone. The ghosts have two movement constraints: they must be moving at all times and they cannot move backwards in the direction they came (for example, when a ghost is moving to the right, it cannot change directions and move to the left). Failure to comply to the mobility constraint causes the ghost to reset to its original starting position. When the game ends (Pac-Man completes his objective or runs out of lives), a final screen is displayed saying whether Pac-Man wins or loses and prints out Pac-Man's final score.

/media/uploads/soapy12312/power-up_resized.jpg

Video demonstration of a single game round. Only one player was present to control Pac-Man. As a result, the Ghosts moved mostly in the same pattern until they hit a wall, became immobile, and reset.

Program Code

Import programPac-Man

This program simulates a game of Pac-Man that allows for multiplayer. One player controls Pac-Man, while two other players control a red and yellow ghost using different tactile switches.


Please log in to post comments.