Zombie Shooter uLCD Game

/media/uploads/rjones75/psdembq.png

Start Screen of the game

This is a zombie game made with the LPC1768 for the uLCD-144-G2. The game begins at the start screen, and is started by pressing the FIRE button. The player is controlled with a navigation switch. Pressing the navigation switch in different directions moves the player on screen, and pressing on the switch is the FIRE button. Once pressed, the game starts. The player moves a blue square in the center to avoid a green square moving towards the player. Based on which direction the player is facing, they can shoot one bullet in that direction. If the bullet connects with the zombie, it is killed and the player gets 10 points added to their score. Once the zombie is killed, another comes in from off screen. Once the zombie reaches the player, the game ends and a Game Over screen appears.

/media/uploads/rjones75/gameover.png

Game Over screen

At the game over screen, the FIRE button can be pressed again and after a second the game returns to the Start screen. The game can be restarted and played as many times as you like. The images for the Start and Game Over screens are stored and read from an SD card on the bottom side of the uLCD. The 4D Graphics Composer was used to format the pictures to appear on the uLCD, similar to the example on the uLCD page. A 0.5W Speaker is used to play sounds when the gun is fired or a zombie is killed. It is connected with a resistor to a TPA2005D1 Class D audio amplifier to give a louder sound. The input used for the amplifier is a PWM output from the mbed. The speaker is played with a thread created using the mbed RTOS library. That way the game does not stop when sounds are played. The main thread handles all the writes to the uLCD and game code. Hit detection is done by checking the positions of the entities, rather than reading pixel colors from the uLCD because that was too slow. Wait commands and increasing the number of iterations of the main loop necessary before movement can be used to slow entities, but was not needed here. Any change to game complexity directly affects the speed it will run at.

/media/uploads/rjones75/img_0466.jpg

Parts used:

How to hook it up:

Class D Audio AmpmbedSpeaker
Out ++
Out --
Pwr +Vout
Pwr -Gnd
In +p21(pwm)
In -Gnd
Navigation Switchmbed
Up11
Cp12
Lp13
Dp14
Rp15
-Gnd
uLCDmbed
5VVu
TXp27
RXp28
GndGnd
Resetp30

Ideas for future development:

  • Could easily set up more zombies, but will make the game run slower.
  • Optimize code for faster execution, like the hit detection code.
  • Allow multiple bullets in one direction.
  • Pickups: bigger bullets, different guns, speed-up, 2x points
  • Co-op with the use of two navigation switches. Would probably slow down the game.

Import programzombie_game

A zombie game made for the uLCD


Please log in to post comments.