A simple one-level platform game. Developed as part of ELEC2645 at University of Leeds, spring 2015.

Dependencies:   N5110 PinDetect PowerControl mbed

An ARM mbed LPC1768 microcontroller have been used to develop a handheld arcade game in the style of an old-school platformer. This project is entirely my own independent work in all stages of the development; including design, defining project specifications, breadboard prototyping, schematic and PCB layout using CAD, assembly, testing and software development. Due to this being part of the ELEC2645 Embedded Systems Project module at University of Leeds, spring 2015, limitations were given on the available hardware components. Credit is due to the authors of the dependent libraries (N5110, Pin Detect, PowerControl and mbed). I would also like to thank the author of Game Programming Patterns as well as the authors of SFML Game Development for providing me with useful sources for programming design patterns.

/media/uploads/Siriagus/game_assembled.jpg

Project aims

  • Implement simple gameplay:
    • A single, fixed (no scrolling) level.
    • Player can move left to right, jump and shoot.
    • Enemies will drop from the top of the screen.
    • The player gets points for shooting enemies.
    • The player dies when it gets hits by an enemy.
  • Implement a simple menu system.
  • Enable the user to adjust the brightness of the display.
  • Output sound to enhance the user experience.

Software

The program flow is controlled by a finite state machine. The implemented design was inspired by the State design pattern from the books Game Programming Patterns and SFML Game Development. The StateManager class is responsible for updating and rendering the current selected state. It also changes the state based on request from the current state. The framework built for the state machine used in this project makes it easy to add new screens. The different main states (indicated by the background colour) and how the user interaction is shown below: /media/uploads/Siriagus/arcadegameuserinteraction.png

Hardware

Schematic:

/media/uploads/Siriagus/schematic.png

Printed circuit board (PCB):

/media/uploads/Siriagus/pcb.png

Images

A seperate program was written to convert images (png) to text-representation of the maps. Enemies and numbers on the screen are also collected from a sprite-sheet created in the same manner.

/media/uploads/Siriagus/unileeds3.png /media/uploads/Siriagus/newmap2.png

Committer:
Siriagus
Date:
Mon May 11 04:40:23 2015 +0000
Revision:
18:709ea375b0df
Parent:
17:d6a3b29cab31
Fixed some formatting errors in documentation.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Siriagus 8:9ac6a428fa26 1 #ifndef RESOURCES_H
Siriagus 8:9ac6a428fa26 2 #define RESOURCES_H
Siriagus 8:9ac6a428fa26 3
Siriagus 17:d6a3b29cab31 4 /// @file Resources.h
Siriagus 17:d6a3b29cab31 5 /// Resource files - sprites/images stored as arrays
Siriagus 8:9ac6a428fa26 6
Siriagus 10:f2488a0ecab7 7 /// Images: Arrays consisting of 1 (opaque) or 0 (blank).
Siriagus 8:9ac6a428fa26 8 namespace Image
Siriagus 12:8178fad5e660 9 {
Siriagus 8:9ac6a428fa26 10 // Player sprite
Siriagus 13:7ab71c7c311b 11 const int Player[5][5] = {
Siriagus 8:9ac6a428fa26 12 {0, 0, 1, 1, 0},
Siriagus 8:9ac6a428fa26 13 {0, 1, 0, 0, 1},
Siriagus 8:9ac6a428fa26 14 {1, 0, 1, 1, 0},
Siriagus 8:9ac6a428fa26 15 {0, 0, 1, 1, 0},
Siriagus 8:9ac6a428fa26 16 {0, 1, 0, 0, 1}
Siriagus 13:7ab71c7c311b 17 };
Siriagus 13:7ab71c7c311b 18
Siriagus 17:d6a3b29cab31 19 const int Pattern3[3][3] = {
Siriagus 17:d6a3b29cab31 20 {1,0,1},
Siriagus 17:d6a3b29cab31 21 {0,1,1},
Siriagus 17:d6a3b29cab31 22 {1,1,1}
Siriagus 13:7ab71c7c311b 23 };
Siriagus 13:7ab71c7c311b 24
Siriagus 17:d6a3b29cab31 25 const int EnemyJumper[4][3] = {
Siriagus 13:7ab71c7c311b 26 {1,1,1},
Siriagus 13:7ab71c7c311b 27 {0,1,0},
Siriagus 13:7ab71c7c311b 28 {1,1,1},
Siriagus 13:7ab71c7c311b 29 {1,0,1}
Siriagus 13:7ab71c7c311b 30 };
Siriagus 13:7ab71c7c311b 31
Siriagus 16:caf613d5b85e 32 const int EnemySimple[5][5] = {
Siriagus 15:d5eb13c4c1c6 33 {1,1,0,0,0},
Siriagus 15:d5eb13c4c1c6 34 {1,1,1,1,0},
Siriagus 13:7ab71c7c311b 35 {0,0,1,0,0},
Siriagus 15:d5eb13c4c1c6 36 {0,1,1,1,1},
Siriagus 13:7ab71c7c311b 37 {1,1,0,1,1}
Siriagus 13:7ab71c7c311b 38 };
Siriagus 15:d5eb13c4c1c6 39
Siriagus 17:d6a3b29cab31 40 const int EnemyRunner[5][6] = {
Siriagus 15:d5eb13c4c1c6 41 {0,1,1,0,0,0},
Siriagus 15:d5eb13c4c1c6 42 {1,1,1,0,0,1},
Siriagus 15:d5eb13c4c1c6 43 {1,1,1,1,1,0},
Siriagus 15:d5eb13c4c1c6 44 {0,1,1,1,1,0},
Siriagus 15:d5eb13c4c1c6 45 {0,1,0,0,1,0}
Siriagus 15:d5eb13c4c1c6 46 };
Siriagus 17:d6a3b29cab31 47 }
Siriagus 17:d6a3b29cab31 48
Siriagus 17:d6a3b29cab31 49 namespace Number
Siriagus 17:d6a3b29cab31 50 {
Siriagus 16:caf613d5b85e 51 /// Contains numbers from 0-9. Each number has the size 3 x 5 pixels
Siriagus 17:d6a3b29cab31 52 const int Zero[5][3] = {
Siriagus 17:d6a3b29cab31 53 {1,1,1},
Siriagus 17:d6a3b29cab31 54 {1,0,1},
Siriagus 17:d6a3b29cab31 55 {1,0,1},
Siriagus 17:d6a3b29cab31 56 {1,0,1},
Siriagus 17:d6a3b29cab31 57 {1,1,1}
Siriagus 17:d6a3b29cab31 58 };
Siriagus 17:d6a3b29cab31 59
Siriagus 17:d6a3b29cab31 60 const int One[5][3] = {
Siriagus 17:d6a3b29cab31 61 {0,1,0},
Siriagus 17:d6a3b29cab31 62 {1,1,0},
Siriagus 17:d6a3b29cab31 63 {0,1,0},
Siriagus 17:d6a3b29cab31 64 {0,1,0},
Siriagus 17:d6a3b29cab31 65 {0,1,0}
Siriagus 17:d6a3b29cab31 66 };
Siriagus 17:d6a3b29cab31 67
Siriagus 17:d6a3b29cab31 68 const int Two[5][3] = {
Siriagus 17:d6a3b29cab31 69 {1,1,1},
Siriagus 17:d6a3b29cab31 70 {0,0,1},
Siriagus 17:d6a3b29cab31 71 {1,1,1},
Siriagus 17:d6a3b29cab31 72 {1,0,0},
Siriagus 17:d6a3b29cab31 73 {1,1,1}
Siriagus 17:d6a3b29cab31 74 };
Siriagus 17:d6a3b29cab31 75
Siriagus 17:d6a3b29cab31 76 const int Three[5][3] = {
Siriagus 17:d6a3b29cab31 77 {1,1,1},
Siriagus 17:d6a3b29cab31 78 {0,0,1},
Siriagus 17:d6a3b29cab31 79 {1,1,1},
Siriagus 17:d6a3b29cab31 80 {0,0,1},
Siriagus 17:d6a3b29cab31 81 {1,1,1}
Siriagus 17:d6a3b29cab31 82 };
Siriagus 17:d6a3b29cab31 83
Siriagus 17:d6a3b29cab31 84 const int Four[5][3] = {
Siriagus 17:d6a3b29cab31 85 {1,0,1},
Siriagus 17:d6a3b29cab31 86 {1,0,1},
Siriagus 17:d6a3b29cab31 87 {1,1,1},
Siriagus 17:d6a3b29cab31 88 {0,0,1},
Siriagus 17:d6a3b29cab31 89 {0,0,1}
Siriagus 17:d6a3b29cab31 90 };
Siriagus 17:d6a3b29cab31 91
Siriagus 17:d6a3b29cab31 92 const int Five[5][3] = {
Siriagus 17:d6a3b29cab31 93 {1,1,1},
Siriagus 17:d6a3b29cab31 94 {1,0,0},
Siriagus 17:d6a3b29cab31 95 {1,1,1},
Siriagus 17:d6a3b29cab31 96 {0,0,1},
Siriagus 17:d6a3b29cab31 97 {1,1,1}
Siriagus 17:d6a3b29cab31 98 };
Siriagus 17:d6a3b29cab31 99
Siriagus 17:d6a3b29cab31 100 const int Six[5][3] = {
Siriagus 17:d6a3b29cab31 101 {1,1,1},
Siriagus 17:d6a3b29cab31 102 {1,0,0},
Siriagus 17:d6a3b29cab31 103 {1,1,1},
Siriagus 17:d6a3b29cab31 104 {1,0,1},
Siriagus 17:d6a3b29cab31 105 {1,1,1}
Siriagus 17:d6a3b29cab31 106 };
Siriagus 17:d6a3b29cab31 107
Siriagus 17:d6a3b29cab31 108 const int Seven[5][3] = {
Siriagus 17:d6a3b29cab31 109 {1,1,1},
Siriagus 17:d6a3b29cab31 110 {0,0,1},
Siriagus 17:d6a3b29cab31 111 {0,0,1},
Siriagus 17:d6a3b29cab31 112 {0,0,1},
Siriagus 17:d6a3b29cab31 113 {0,0,1}
Siriagus 17:d6a3b29cab31 114 };
Siriagus 17:d6a3b29cab31 115
Siriagus 17:d6a3b29cab31 116 const int Eight[5][3] = {
Siriagus 17:d6a3b29cab31 117 {1,1,1},
Siriagus 17:d6a3b29cab31 118 {1,0,1},
Siriagus 17:d6a3b29cab31 119 {1,1,1},
Siriagus 17:d6a3b29cab31 120 {1,0,1},
Siriagus 17:d6a3b29cab31 121 {1,1,1}
Siriagus 17:d6a3b29cab31 122 };
Siriagus 17:d6a3b29cab31 123
Siriagus 17:d6a3b29cab31 124 const int Nine[5][3] = {
Siriagus 17:d6a3b29cab31 125 {1,1,1},
Siriagus 17:d6a3b29cab31 126 {1,0,1},
Siriagus 17:d6a3b29cab31 127 {1,1,1},
Siriagus 17:d6a3b29cab31 128 {0,0,1},
Siriagus 17:d6a3b29cab31 129 {0,0,1}
Siriagus 16:caf613d5b85e 130 };
Siriagus 8:9ac6a428fa26 131 }
Siriagus 8:9ac6a428fa26 132
Siriagus 8:9ac6a428fa26 133 #endif