Labyrinth of the Minotaur A simple roguelike/RPG using a nokia 5110 screen
Dependencies: N5110 PowerControl mbed
Game.h@34:e58c8322884d, 2015-05-11 (annotated)
- Committer:
- ThomasBGill
- Date:
- Mon May 11 12:56:26 2015 +0000
- Revision:
- 34:e58c8322884d
- Parent:
- 33:4fc26476b2e0
- Child:
- 35:2c290fa78f1d
Game.h function commenting finished
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ThomasBGill | 33:4fc26476b2e0 | 1 | /** |
ThomasBGill | 33:4fc26476b2e0 | 2 | @file Game.h |
ThomasBGill | 33:4fc26476b2e0 | 3 | @brief Header file containing the main game member functions and variables |
ThomasBGill | 33:4fc26476b2e0 | 4 | @brief Revision 1.0 |
ThomasBGill | 33:4fc26476b2e0 | 5 | @author Thomas Barnaby Gill |
ThomasBGill | 33:4fc26476b2e0 | 6 | @date 11th May 2015 |
ThomasBGill | 33:4fc26476b2e0 | 7 | */ |
ThomasBGill | 33:4fc26476b2e0 | 8 | |
ThomasBGill | 26:0dd71fc0ede4 | 9 | #include "N5110.h" |
ThomasBGill | 26:0dd71fc0ede4 | 10 | #include "PowerControl/PowerControl.h" |
ThomasBGill | 26:0dd71fc0ede4 | 11 | #include "PowerControl/EthernetPowerControl.h" |
ThomasBGill | 26:0dd71fc0ede4 | 12 | #include "WorldBuilder.h" |
ThomasBGill | 26:0dd71fc0ede4 | 13 | #include "Graphics.h" |
ThomasBGill | 26:0dd71fc0ede4 | 14 | |
ThomasBGill | 33:4fc26476b2e0 | 15 | //vcc sce rst dc mosi clk led |
ThomasBGill | 31:5b4a4d225ab4 | 16 | N5110 lcd(p7, p8, p9, p10, p11, p13, p26); |
ThomasBGill | 31:5b4a4d225ab4 | 17 | InterruptIn Act(p27); |
ThomasBGill | 31:5b4a4d225ab4 | 18 | InterruptIn Start(p28); |
ThomasBGill | 26:0dd71fc0ede4 | 19 | AnalogIn Noise(p19); |
ThomasBGill | 31:5b4a4d225ab4 | 20 | AnalogIn xPot(p15); |
ThomasBGill | 31:5b4a4d225ab4 | 21 | AnalogIn yPot(p16); |
ThomasBGill | 31:5b4a4d225ab4 | 22 | |
ThomasBGill | 32:99ca304085e6 | 23 | #define PH_MAX 20 |
ThomasBGill | 32:99ca304085e6 | 24 | |
ThomasBGill | 31:5b4a4d225ab4 | 25 | //Joystick stuff |
ThomasBGill | 31:5b4a4d225ab4 | 26 | // timer to regularly read the joystick |
ThomasBGill | 31:5b4a4d225ab4 | 27 | Ticker pollJoystick; |
ThomasBGill | 31:5b4a4d225ab4 | 28 | |
ThomasBGill | 31:5b4a4d225ab4 | 29 | // change this to alter tolerance of joystick direction |
ThomasBGill | 31:5b4a4d225ab4 | 30 | #define DIRECTION_TOLERANCE 0.05 |
ThomasBGill | 31:5b4a4d225ab4 | 31 | |
ThomasBGill | 31:5b4a4d225ab4 | 32 | // create enumerated type (0,1,2,3 etc. for direction) |
ThomasBGill | 31:5b4a4d225ab4 | 33 | // could be extended for diagonals etc. |
ThomasBGill | 31:5b4a4d225ab4 | 34 | enum DirectionName { |
ThomasBGill | 31:5b4a4d225ab4 | 35 | Up, |
ThomasBGill | 31:5b4a4d225ab4 | 36 | Down, |
ThomasBGill | 31:5b4a4d225ab4 | 37 | Left, |
ThomasBGill | 31:5b4a4d225ab4 | 38 | Right, |
ThomasBGill | 31:5b4a4d225ab4 | 39 | Centre, |
ThomasBGill | 31:5b4a4d225ab4 | 40 | Unknown |
ThomasBGill | 31:5b4a4d225ab4 | 41 | }; |
ThomasBGill | 31:5b4a4d225ab4 | 42 | |
ThomasBGill | 31:5b4a4d225ab4 | 43 | // struct for Joystick |
ThomasBGill | 31:5b4a4d225ab4 | 44 | typedef struct JoyStick Joystick; |
ThomasBGill | 31:5b4a4d225ab4 | 45 | struct JoyStick { |
ThomasBGill | 31:5b4a4d225ab4 | 46 | float x; // current x value |
ThomasBGill | 31:5b4a4d225ab4 | 47 | float x0; // 'centred' x value |
ThomasBGill | 31:5b4a4d225ab4 | 48 | float y; // current y value |
ThomasBGill | 31:5b4a4d225ab4 | 49 | float y0; // 'centred' y value |
ThomasBGill | 31:5b4a4d225ab4 | 50 | int button; // button state (assume pull-down used, so 1 = pressed, 0 = unpressed) |
ThomasBGill | 31:5b4a4d225ab4 | 51 | DirectionName direction; // current direction |
ThomasBGill | 31:5b4a4d225ab4 | 52 | }; |
ThomasBGill | 31:5b4a4d225ab4 | 53 | // create struct variable |
ThomasBGill | 31:5b4a4d225ab4 | 54 | Joystick joystick; |
ThomasBGill | 31:5b4a4d225ab4 | 55 | |
ThomasBGill | 31:5b4a4d225ab4 | 56 | // function prototypes |
ThomasBGill | 31:5b4a4d225ab4 | 57 | void calibrateJoystick(); |
ThomasBGill | 31:5b4a4d225ab4 | 58 | void updateJoystick(); |
ThomasBGill | 26:0dd71fc0ede4 | 59 | |
ThomasBGill | 26:0dd71fc0ede4 | 60 | #define USR_POWERDOWN (0x104) |
ThomasBGill | 26:0dd71fc0ede4 | 61 | |
ThomasBGill | 26:0dd71fc0ede4 | 62 | LocalFileSystem local("local"); // create local filesystem |
ThomasBGill | 26:0dd71fc0ede4 | 63 | |
ThomasBGill | 26:0dd71fc0ede4 | 64 | struct TILES { |
ThomasBGill | 26:0dd71fc0ede4 | 65 | char Symbol; // Symbol for this tile |
ThomasBGill | 26:0dd71fc0ede4 | 66 | bool Passable; // Can tile be walked on |
ThomasBGill | 26:0dd71fc0ede4 | 67 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 68 | |
ThomasBGill | 26:0dd71fc0ede4 | 69 | TILES TileList[] = { |
ThomasBGill | 26:0dd71fc0ede4 | 70 | { '#', false }, // 0- WALL |
ThomasBGill | 26:0dd71fc0ede4 | 71 | { '.', true }, // 1- FLOOR |
ThomasBGill | 26:0dd71fc0ede4 | 72 | { '+', true }, // 2- ENTER |
ThomasBGill | 26:0dd71fc0ede4 | 73 | { 'x', true }, // 3- EXIT |
ThomasBGill | 26:0dd71fc0ede4 | 74 | { '.', true }, // 4- FLOOR_SEEN |
ThomasBGill | 26:0dd71fc0ede4 | 75 | { '=', true }, // 5- CHEST |
ThomasBGill | 26:0dd71fc0ede4 | 76 | { '/', true }, // 6- CHEST_OPENED |
ThomasBGill | 26:0dd71fc0ede4 | 77 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 78 | |
ThomasBGill | 26:0dd71fc0ede4 | 79 | struct ITEMS { |
ThomasBGill | 26:0dd71fc0ede4 | 80 | char ItemName[15]; //Item name |
ThomasBGill | 26:0dd71fc0ede4 | 81 | int ItemValue; //Damage/ armour value |
ThomasBGill | 26:0dd71fc0ede4 | 82 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 83 | |
ThomasBGill | 26:0dd71fc0ede4 | 84 | ITEMS ItemList[] = { |
ThomasBGill | 26:0dd71fc0ede4 | 85 | //Weapons |
ThomasBGill | 26:0dd71fc0ede4 | 86 | { "Dagger", 4 }, //0 |
ThomasBGill | 26:0dd71fc0ede4 | 87 | { "Axe", 5 }, //1 |
ThomasBGill | 26:0dd71fc0ede4 | 88 | { "Mace", 6 }, //2 |
ThomasBGill | 26:0dd71fc0ede4 | 89 | { "Sword", 7 }, //3 |
ThomasBGill | 26:0dd71fc0ede4 | 90 | { "Warhammer", 8 }, //4 |
ThomasBGill | 26:0dd71fc0ede4 | 91 | //Armour |
ThomasBGill | 30:4a03611a3d99 | 92 | { "Cloth armour", 0 }, //5 |
ThomasBGill | 30:4a03611a3d99 | 93 | { "Leather armour", 1 }, //6 |
ThomasBGill | 30:4a03611a3d99 | 94 | { "Studded armour", 2 }, //7 |
ThomasBGill | 30:4a03611a3d99 | 95 | { "Chainmail vest", 3 }, //8 |
ThomasBGill | 30:4a03611a3d99 | 96 | { "Plate armour", 4 }, //9 |
ThomasBGill | 26:0dd71fc0ede4 | 97 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 98 | |
ThomasBGill | 26:0dd71fc0ede4 | 99 | struct ENEMIES { |
ThomasBGill | 26:0dd71fc0ede4 | 100 | char EName[9]; //Enemy name |
ThomasBGill | 26:0dd71fc0ede4 | 101 | int EHealth; //Enemy health |
ThomasBGill | 26:0dd71fc0ede4 | 102 | int EDamage; //Enemy damage |
ThomasBGill | 26:0dd71fc0ede4 | 103 | int EArmour; //Enemy armour |
ThomasBGill | 26:0dd71fc0ede4 | 104 | int EDodge; //Enemy dodge chance |
ThomasBGill | 26:0dd71fc0ede4 | 105 | int EHit; //Enemy hit chance |
ThomasBGill | 26:0dd71fc0ede4 | 106 | int ESpd; //Enemy speed (used for running away during fights) |
ThomasBGill | 26:0dd71fc0ede4 | 107 | int EPoints; //How many points the monster is worth |
ThomasBGill | 26:0dd71fc0ede4 | 108 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 109 | |
ThomasBGill | 26:0dd71fc0ede4 | 110 | ENEMIES EnemyList[] = { |
ThomasBGill | 26:0dd71fc0ede4 | 111 | //Name HP Dmg Arm Dg Ht Spd Pts |
ThomasBGill | 26:0dd71fc0ede4 | 112 | { "Huge Rat", 5, 3, 0, 25, 70, 40, 1 }, //0- Huge Rat |
ThomasBGill | 26:0dd71fc0ede4 | 113 | { "Goblin", 6, 3, 1, 25, 60, 30, 3 }, //1- Goblin |
ThomasBGill | 26:0dd71fc0ede4 | 114 | { "Skeleton", 8, 4, 2, 10, 50, 10, 5 }, //2- Skeleton |
ThomasBGill | 26:0dd71fc0ede4 | 115 | { "Wraith", 5, 4, 0, 40, 60, 50, 10 }, //3- Wraith |
ThomasBGill | 26:0dd71fc0ede4 | 116 | { "Ogre", 10, 7, 3, 10, 35, 15, 15 }, //4- Ogre |
ThomasBGill | 26:0dd71fc0ede4 | 117 | { "Minotaur", 15, 8, 4, 20, 45, 100, 50 }, //5- Minotaur |
ThomasBGill | 26:0dd71fc0ede4 | 118 | }; |
ThomasBGill | 26:0dd71fc0ede4 | 119 | |
ThomasBGill | 26:0dd71fc0ede4 | 120 | //Variables |
ThomasBGill | 26:0dd71fc0ede4 | 121 | int ActFlag = 0; |
ThomasBGill | 26:0dd71fc0ede4 | 122 | int StartFlag = 0; |
ThomasBGill | 31:5b4a4d225ab4 | 123 | //int DirFlag = 0; |
ThomasBGill | 26:0dd71fc0ede4 | 124 | |
ThomasBGill | 26:0dd71fc0ede4 | 125 | //Space type player is on |
ThomasBGill | 26:0dd71fc0ede4 | 126 | int pSpace; |
ThomasBGill | 26:0dd71fc0ede4 | 127 | |
ThomasBGill | 26:0dd71fc0ede4 | 128 | //Player Health |
ThomasBGill | 29:89bc8c8aa8ac | 129 | int ph = PH_MAX; |
ThomasBGill | 26:0dd71fc0ede4 | 130 | |
ThomasBGill | 26:0dd71fc0ede4 | 131 | //Player weapon |
ThomasBGill | 26:0dd71fc0ede4 | 132 | int pw = 0; //0 to 4 |
ThomasBGill | 26:0dd71fc0ede4 | 133 | |
ThomasBGill | 26:0dd71fc0ede4 | 134 | //Player armour |
ThomasBGill | 26:0dd71fc0ede4 | 135 | int pa = 5; //5 to 9 |
ThomasBGill | 26:0dd71fc0ede4 | 136 | |
ThomasBGill | 34:e58c8322884d | 137 | //Monster health |
ThomasBGill | 34:e58c8322884d | 138 | int mh; |
ThomasBGill | 34:e58c8322884d | 139 | |
ThomasBGill | 26:0dd71fc0ede4 | 140 | //Player score |
ThomasBGill | 26:0dd71fc0ede4 | 141 | int score = -100; //100 level, x monster, 10 chest, -2 running away |
ThomasBGill | 26:0dd71fc0ede4 | 142 | |
ThomasBGill | 26:0dd71fc0ede4 | 143 | //High scores |
ThomasBGill | 26:0dd71fc0ede4 | 144 | int HScore1; |
ThomasBGill | 26:0dd71fc0ede4 | 145 | int HScore2; |
ThomasBGill | 26:0dd71fc0ede4 | 146 | int HScore3; |
ThomasBGill | 26:0dd71fc0ede4 | 147 | int HScore4; |
ThomasBGill | 26:0dd71fc0ede4 | 148 | |
ThomasBGill | 26:0dd71fc0ede4 | 149 | bool BossFight = false; |
ThomasBGill | 26:0dd71fc0ede4 | 150 | |
ThomasBGill | 26:0dd71fc0ede4 | 151 | //Voids |
ThomasBGill | 33:4fc26476b2e0 | 152 | /** Semihost Powerdown |
ThomasBGill | 33:4fc26476b2e0 | 153 | * |
ThomasBGill | 33:4fc26476b2e0 | 154 | * Powers down the ethernet |
ThomasBGill | 33:4fc26476b2e0 | 155 | * |
ThomasBGill | 33:4fc26476b2e0 | 156 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 157 | int semihost_powerdown(); |
ThomasBGill | 26:0dd71fc0ede4 | 158 | |
ThomasBGill | 33:4fc26476b2e0 | 159 | /** Act Button Pressed |
ThomasBGill | 33:4fc26476b2e0 | 160 | * |
ThomasBGill | 33:4fc26476b2e0 | 161 | * Interrupt Service Routine for the act button |
ThomasBGill | 33:4fc26476b2e0 | 162 | * |
ThomasBGill | 33:4fc26476b2e0 | 163 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 164 | void ActPressed(); |
ThomasBGill | 33:4fc26476b2e0 | 165 | |
ThomasBGill | 33:4fc26476b2e0 | 166 | /** Start Button Pressed |
ThomasBGill | 33:4fc26476b2e0 | 167 | * |
ThomasBGill | 33:4fc26476b2e0 | 168 | * Interrupt Service Routine for the act button |
ThomasBGill | 33:4fc26476b2e0 | 169 | * |
ThomasBGill | 33:4fc26476b2e0 | 170 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 171 | void StartPressed(); |
ThomasBGill | 33:4fc26476b2e0 | 172 | |
ThomasBGill | 33:4fc26476b2e0 | 173 | /** Write Data to File |
ThomasBGill | 33:4fc26476b2e0 | 174 | * |
ThomasBGill | 33:4fc26476b2e0 | 175 | * Writes the highscores to the .txt file |
ThomasBGill | 33:4fc26476b2e0 | 176 | * |
ThomasBGill | 33:4fc26476b2e0 | 177 | */ |
ThomasBGill | 33:4fc26476b2e0 | 178 | void writeDataToFile(); |
ThomasBGill | 26:0dd71fc0ede4 | 179 | |
ThomasBGill | 33:4fc26476b2e0 | 180 | /** Write Data to File |
ThomasBGill | 33:4fc26476b2e0 | 181 | * |
ThomasBGill | 33:4fc26476b2e0 | 182 | * Reads the highscores from the .txt file and stores the values obtained to the high score integers |
ThomasBGill | 33:4fc26476b2e0 | 183 | * |
ThomasBGill | 33:4fc26476b2e0 | 184 | */ |
ThomasBGill | 27:1ad2408ba702 | 185 | void readDataFromFile(); |
ThomasBGill | 33:4fc26476b2e0 | 186 | |
ThomasBGill | 33:4fc26476b2e0 | 187 | /** High Score Check |
ThomasBGill | 33:4fc26476b2e0 | 188 | * |
ThomasBGill | 33:4fc26476b2e0 | 189 | * Compares the current score with the saved high scores, arranges the scores in order and then saves the scores to the .txt file |
ThomasBGill | 33:4fc26476b2e0 | 190 | * |
ThomasBGill | 33:4fc26476b2e0 | 191 | */ |
ThomasBGill | 27:1ad2408ba702 | 192 | void HighScoreCheck(); |
ThomasBGill | 26:0dd71fc0ede4 | 193 | |
ThomasBGill | 33:4fc26476b2e0 | 194 | /** Flash Screen |
ThomasBGill | 33:4fc26476b2e0 | 195 | * |
ThomasBGill | 33:4fc26476b2e0 | 196 | * Inverts and then uninverts the screen's colours |
ThomasBGill | 33:4fc26476b2e0 | 197 | * @param n- Number of times the screen flashes |
ThomasBGill | 33:4fc26476b2e0 | 198 | * |
ThomasBGill | 33:4fc26476b2e0 | 199 | */ |
ThomasBGill | 33:4fc26476b2e0 | 200 | void FlashScreen(int n); |
ThomasBGill | 33:4fc26476b2e0 | 201 | |
ThomasBGill | 33:4fc26476b2e0 | 202 | /** Draw Graphic |
ThomasBGill | 33:4fc26476b2e0 | 203 | * |
ThomasBGill | 33:4fc26476b2e0 | 204 | * Draws a 38x38 pixel image from a starting point |
ThomasBGill | 33:4fc26476b2e0 | 205 | * @param p- Which image to draw (0- Huge Rat, 1- Goblin, 2- Skeleton, 3- Wraith, 4- Ogre, 5- Minotaur) |
ThomasBGill | 33:4fc26476b2e0 | 206 | * @param x- x co-ordinate of starting position |
ThomasBGill | 33:4fc26476b2e0 | 207 | * @param y- y co-ordinate of starting position |
ThomasBGill | 33:4fc26476b2e0 | 208 | * |
ThomasBGill | 33:4fc26476b2e0 | 209 | */ |
ThomasBGill | 28:b3a597b38b60 | 210 | void DrawGraphic(int p, int x, int y); |
ThomasBGill | 28:b3a597b38b60 | 211 | |
ThomasBGill | 33:4fc26476b2e0 | 212 | /** Intro |
ThomasBGill | 33:4fc26476b2e0 | 213 | * |
ThomasBGill | 33:4fc26476b2e0 | 214 | * Displays the game title when the system is turned on |
ThomasBGill | 33:4fc26476b2e0 | 215 | * |
ThomasBGill | 33:4fc26476b2e0 | 216 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 217 | void Intro(); |
ThomasBGill | 33:4fc26476b2e0 | 218 | |
ThomasBGill | 33:4fc26476b2e0 | 219 | /** Initilize |
ThomasBGill | 33:4fc26476b2e0 | 220 | * |
ThomasBGill | 33:4fc26476b2e0 | 221 | * Initilizes the score, level number and player health and equipment |
ThomasBGill | 33:4fc26476b2e0 | 222 | * |
ThomasBGill | 33:4fc26476b2e0 | 223 | * |
ThomasBGill | 33:4fc26476b2e0 | 224 | */ |
ThomasBGill | 33:4fc26476b2e0 | 225 | void Initilize(); |
ThomasBGill | 34:e58c8322884d | 226 | |
ThomasBGill | 34:e58c8322884d | 227 | /** Main Menu |
ThomasBGill | 34:e58c8322884d | 228 | * |
ThomasBGill | 34:e58c8322884d | 229 | * Displays a menu where the user can choose to start the game, view highscores or view the option menu |
ThomasBGill | 34:e58c8322884d | 230 | * |
ThomasBGill | 34:e58c8322884d | 231 | * |
ThomasBGill | 34:e58c8322884d | 232 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 233 | void MainMenu(); |
ThomasBGill | 34:e58c8322884d | 234 | |
ThomasBGill | 34:e58c8322884d | 235 | /** Options Menu |
ThomasBGill | 34:e58c8322884d | 236 | * |
ThomasBGill | 34:e58c8322884d | 237 | * Allows the user to turn the screen backlight on or off |
ThomasBGill | 34:e58c8322884d | 238 | * |
ThomasBGill | 34:e58c8322884d | 239 | * |
ThomasBGill | 34:e58c8322884d | 240 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 241 | void Options(); |
ThomasBGill | 34:e58c8322884d | 242 | |
ThomasBGill | 34:e58c8322884d | 243 | /** Level Screen |
ThomasBGill | 34:e58c8322884d | 244 | * |
ThomasBGill | 34:e58c8322884d | 245 | * Displays which level the user is about to enter |
ThomasBGill | 34:e58c8322884d | 246 | * |
ThomasBGill | 34:e58c8322884d | 247 | * |
ThomasBGill | 34:e58c8322884d | 248 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 249 | void LevelScreen(); |
ThomasBGill | 34:e58c8322884d | 250 | |
ThomasBGill | 34:e58c8322884d | 251 | /** Next Level |
ThomasBGill | 34:e58c8322884d | 252 | * |
ThomasBGill | 34:e58c8322884d | 253 | * Increases the score, generates the next level and then initilizes the random seed |
ThomasBGill | 34:e58c8322884d | 254 | * |
ThomasBGill | 34:e58c8322884d | 255 | * |
ThomasBGill | 34:e58c8322884d | 256 | */ |
ThomasBGill | 34:e58c8322884d | 257 | void NextLevel(); |
ThomasBGill | 34:e58c8322884d | 258 | |
ThomasBGill | 34:e58c8322884d | 259 | /** Game Loop |
ThomasBGill | 34:e58c8322884d | 260 | * |
ThomasBGill | 34:e58c8322884d | 261 | * The main loop while the game is running. |
ThomasBGill | 34:e58c8322884d | 262 | * Checks if the user is interacting with a chest, moving the analogue stick or pressing a button and then calls the corresponding function |
ThomasBGill | 34:e58c8322884d | 263 | * |
ThomasBGill | 34:e58c8322884d | 264 | * |
ThomasBGill | 34:e58c8322884d | 265 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 266 | void GameLoop(); |
ThomasBGill | 34:e58c8322884d | 267 | |
ThomasBGill | 34:e58c8322884d | 268 | /** Player Camera |
ThomasBGill | 34:e58c8322884d | 269 | * |
ThomasBGill | 34:e58c8322884d | 270 | * Displays the map around the player as characters on the screen |
ThomasBGill | 34:e58c8322884d | 271 | * |
ThomasBGill | 34:e58c8322884d | 272 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 273 | void PlayerCamera(); |
ThomasBGill | 34:e58c8322884d | 274 | |
ThomasBGill | 34:e58c8322884d | 275 | /** Player Move |
ThomasBGill | 34:e58c8322884d | 276 | * |
ThomasBGill | 34:e58c8322884d | 277 | * Checks which way the analogue stick was moved and then moves the player into that space if the tile is passable |
ThomasBGill | 34:e58c8322884d | 278 | * |
ThomasBGill | 34:e58c8322884d | 279 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 280 | void PlayerMove(); |
ThomasBGill | 34:e58c8322884d | 281 | |
ThomasBGill | 34:e58c8322884d | 282 | /** Fight |
ThomasBGill | 34:e58c8322884d | 283 | * |
ThomasBGill | 34:e58c8322884d | 284 | * Function called during a fight. |
ThomasBGill | 34:e58c8322884d | 285 | * It first displays the opponent and then gives the user the option to fight or run away. |
ThomasBGill | 34:e58c8322884d | 286 | * The loop ends if the player runs away, kills the opponent or is killed. |
ThomasBGill | 34:e58c8322884d | 287 | * |
ThomasBGill | 34:e58c8322884d | 288 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 289 | void Fight(); |
ThomasBGill | 34:e58c8322884d | 290 | |
ThomasBGill | 34:e58c8322884d | 291 | /** Monster Attack |
ThomasBGill | 34:e58c8322884d | 292 | * |
ThomasBGill | 34:e58c8322884d | 293 | * Calculates the damage the opponent does to the player |
ThomasBGill | 34:e58c8322884d | 294 | * |
ThomasBGill | 34:e58c8322884d | 295 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 296 | void MonsterAttack(int m); |
ThomasBGill | 34:e58c8322884d | 297 | |
ThomasBGill | 34:e58c8322884d | 298 | /** Player Attack |
ThomasBGill | 34:e58c8322884d | 299 | * |
ThomasBGill | 34:e58c8322884d | 300 | * Calculates the damage the player does to the opponent |
ThomasBGill | 34:e58c8322884d | 301 | * |
ThomasBGill | 34:e58c8322884d | 302 | */ |
ThomasBGill | 34:e58c8322884d | 303 | void PlayerAttack(int m); |
ThomasBGill | 34:e58c8322884d | 304 | |
ThomasBGill | 34:e58c8322884d | 305 | /** Start Menu |
ThomasBGill | 34:e58c8322884d | 306 | * |
ThomasBGill | 34:e58c8322884d | 307 | * Displays a screen showing the player's current health and a menu where the user can view the map, map legend and inventory |
ThomasBGill | 34:e58c8322884d | 308 | * |
ThomasBGill | 34:e58c8322884d | 309 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 310 | void StartMenu(); |
ThomasBGill | 34:e58c8322884d | 311 | |
ThomasBGill | 34:e58c8322884d | 312 | /** Map |
ThomasBGill | 34:e58c8322884d | 313 | * |
ThomasBGill | 34:e58c8322884d | 314 | * Calls the functions which displays the map of the current level on the screen and flashes the player's current location |
ThomasBGill | 34:e58c8322884d | 315 | * |
ThomasBGill | 34:e58c8322884d | 316 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 317 | void Map(); |
ThomasBGill | 34:e58c8322884d | 318 | |
ThomasBGill | 34:e58c8322884d | 319 | /** Draw Map |
ThomasBGill | 34:e58c8322884d | 320 | * |
ThomasBGill | 34:e58c8322884d | 321 | * Displays the map of the current level on the screen |
ThomasBGill | 34:e58c8322884d | 322 | * |
ThomasBGill | 34:e58c8322884d | 323 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 324 | void DrawMap(); |
ThomasBGill | 34:e58c8322884d | 325 | |
ThomasBGill | 34:e58c8322884d | 326 | /** Flash Player Location |
ThomasBGill | 34:e58c8322884d | 327 | * |
ThomasBGill | 34:e58c8322884d | 328 | * Flashes the player's current location on the screen |
ThomasBGill | 34:e58c8322884d | 329 | * |
ThomasBGill | 34:e58c8322884d | 330 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 331 | void FlashPlayerLocation(); |
ThomasBGill | 34:e58c8322884d | 332 | |
ThomasBGill | 34:e58c8322884d | 333 | /** Map legend |
ThomasBGill | 34:e58c8322884d | 334 | * |
ThomasBGill | 34:e58c8322884d | 335 | * Displays a screen showing what each character represents on the main game screen |
ThomasBGill | 34:e58c8322884d | 336 | * |
ThomasBGill | 34:e58c8322884d | 337 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 338 | void MapLegend(); |
ThomasBGill | 34:e58c8322884d | 339 | |
ThomasBGill | 34:e58c8322884d | 340 | /** Inventory |
ThomasBGill | 34:e58c8322884d | 341 | * |
ThomasBGill | 34:e58c8322884d | 342 | * Displays a screen showing what weapon and armour the player has equipped. |
ThomasBGill | 34:e58c8322884d | 343 | * |
ThomasBGill | 34:e58c8322884d | 344 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 345 | void Inventory(); |
ThomasBGill | 34:e58c8322884d | 346 | |
ThomasBGill | 34:e58c8322884d | 347 | /** Chest |
ThomasBGill | 34:e58c8322884d | 348 | * |
ThomasBGill | 34:e58c8322884d | 349 | * Generates either an item, potion, map or booby trap in the chest as it is opened. |
ThomasBGill | 34:e58c8322884d | 350 | * |
ThomasBGill | 34:e58c8322884d | 351 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 352 | void Chest(); |
ThomasBGill | 34:e58c8322884d | 353 | |
ThomasBGill | 34:e58c8322884d | 354 | /** Get Item |
ThomasBGill | 34:e58c8322884d | 355 | * |
ThomasBGill | 34:e58c8322884d | 356 | * Generates an item from the list of items and asks if the player wants to equip it. |
ThomasBGill | 34:e58c8322884d | 357 | * |
ThomasBGill | 34:e58c8322884d | 358 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 359 | void getItem(); |
ThomasBGill | 34:e58c8322884d | 360 | |
ThomasBGill | 34:e58c8322884d | 361 | /** Booby Trap |
ThomasBGill | 34:e58c8322884d | 362 | * |
ThomasBGill | 34:e58c8322884d | 363 | * Damages the player for 0-5 damage. If the damage is 0 the trap will display as having failed. |
ThomasBGill | 34:e58c8322884d | 364 | * |
ThomasBGill | 34:e58c8322884d | 365 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 366 | void BoobyTrap(); |
ThomasBGill | 34:e58c8322884d | 367 | |
ThomasBGill | 34:e58c8322884d | 368 | /** Reveal Map |
ThomasBGill | 34:e58c8322884d | 369 | * |
ThomasBGill | 34:e58c8322884d | 370 | * Turns all the unseen floors into seen ones. |
ThomasBGill | 34:e58c8322884d | 371 | * |
ThomasBGill | 34:e58c8322884d | 372 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 373 | void RevealMap(); |
ThomasBGill | 34:e58c8322884d | 374 | |
ThomasBGill | 34:e58c8322884d | 375 | /** Potion |
ThomasBGill | 34:e58c8322884d | 376 | * |
ThomasBGill | 34:e58c8322884d | 377 | * Generates either a potion that heals the player, damages the player or transports them to the next level |
ThomasBGill | 34:e58c8322884d | 378 | * |
ThomasBGill | 34:e58c8322884d | 379 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 380 | void Potion(); |
ThomasBGill | 34:e58c8322884d | 381 | |
ThomasBGill | 34:e58c8322884d | 382 | /** Game Over |
ThomasBGill | 34:e58c8322884d | 383 | * |
ThomasBGill | 34:e58c8322884d | 384 | * Displays the game over screen |
ThomasBGill | 34:e58c8322884d | 385 | * |
ThomasBGill | 34:e58c8322884d | 386 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 387 | void GameOver(); |
ThomasBGill | 34:e58c8322884d | 388 | |
ThomasBGill | 34:e58c8322884d | 389 | /** Score Screen |
ThomasBGill | 34:e58c8322884d | 390 | * |
ThomasBGill | 34:e58c8322884d | 391 | * Displays the user's final score |
ThomasBGill | 34:e58c8322884d | 392 | * |
ThomasBGill | 34:e58c8322884d | 393 | */ |
ThomasBGill | 26:0dd71fc0ede4 | 394 | void ScoreScreen(); |
ThomasBGill | 34:e58c8322884d | 395 | |
ThomasBGill | 34:e58c8322884d | 396 | /** High Score Screen |
ThomasBGill | 34:e58c8322884d | 397 | * |
ThomasBGill | 34:e58c8322884d | 398 | * Displays the top 4 high scores |
ThomasBGill | 34:e58c8322884d | 399 | * |
ThomasBGill | 34:e58c8322884d | 400 | */ |
ThomasBGill | 33:4fc26476b2e0 | 401 | void HighScoreScreen(); |