
Labyrinth of the Minotaur A simple roguelike/RPG using a nokia 5110 screen
Dependencies: N5110 PowerControl mbed
Revision 36:b64696135142, committed 2015-05-11
- Comitter:
- ThomasBGill
- Date:
- Mon May 11 22:25:57 2015 +0000
- Parent:
- 35:2c290fa78f1d
- Child:
- 37:a0ea57af9279
- Commit message:
- Version 1.0 finished
Changed in this revision
--- a/Graphics/Graphics.h Mon May 11 22:03:41 2015 +0000 +++ b/Graphics/Graphics.h Mon May 11 22:25:57 2015 +0000 @@ -1,11 +1,50 @@ +/** +* @file Graphics.h +* @brief Header file containing the graphic information arrays +* @brief Revision 1.0 +* +* @author Thomas Barnaby Gill +* @date 11th May 2015 +*/ + +/** Huge Rat Graphic Array +* +* @param HugeRat - Boolean array storing the 38x38 image of the huge rat. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool HugeRat[38][38]; +/** Goblin Graphic Array +* +* @param Goblin - Boolean array storing the 38x38 image of the goblin. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool Goblin[38][38]; +/** Skeleton Graphic Array +* +* @param Skeleton - Boolean array storing the 38x38 image of the skeleton. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool Skeleton[38][38]; +/** Wraith Graphic Array +* +* @param Wraith - Boolean array storing the 38x38 image of the wraith. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool Wraith[38][38]; +/** Ogre Graphic Array +* +* @param Ogre - Boolean array storing the 38x38 image of the ogre. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool Ogre[38][38]; +/** Minotaur Graphic Array +* +* @param Minotaur - Boolean array storing the 38x38 image of the minotaur. 1 for a set pixel, 0 for an unset pixel +* +*/ extern bool Minotaur[38][38]; \ No newline at end of file
--- a/N5110.lib Mon May 11 22:03:41 2015 +0000 +++ b/N5110.lib Mon May 11 22:25:57 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/eencae/code/N5110/#93aec66eb6fa +http://developer.mbed.org/users/ThomasBGill/code/N5110/#ba8addc061ea
--- a/PowerControl.lib Mon May 11 22:03:41 2015 +0000 +++ b/PowerControl.lib Mon May 11 22:25:57 2015 +0000 @@ -1,1 +1,1 @@ -PowerControl#d0fa2aeb02a4 +http://developer.mbed.org/users/ThomasBGill/code/PowerControl/#d0fa2aeb02a4
--- a/WorldBuilder/WorldBuilder.cpp Mon May 11 22:03:41 2015 +0000 +++ b/WorldBuilder/WorldBuilder.cpp Mon May 11 22:25:57 2015 +0000 @@ -34,6 +34,8 @@ void FirstRoom() { //Create initial room + + //Generate starting coordinates int si = rand()%25 + 1; int sj = rand()%15 + 1; @@ -55,8 +57,9 @@ void ExitRoom() { - //Create exit room + + //Generate starting coordinates int si = rand()%50 + 30; int sj = rand()%25 + 20; @@ -77,6 +80,7 @@ void DungeonRoomBuilder() { + //Generate starting coordinates sx = rand() % (MAP_WIDTH - 1) + 1; sy = rand() % (MAP_HEIGHT - 1) + 1; @@ -95,6 +99,7 @@ } if (rand() % 3 == 0) { + //Build chest at random coordinate in room int i = rand() % sw + sx; int j = rand() % sh + sy; map[i][j] = CHEST; @@ -124,11 +129,12 @@ void DeadEnds(int d) { - for (int del = d; del > 0; del--) { + for (int del = d; del > 0; del--) { //Iterate the code d amount of times + for (int i = 0; i < 84; i++) { for (int j = 0; j < 48; j++) { - if (Neighbours(i, j) < 2) { + if (Neighbours(i, j) < 2) { //If an island or dead end then turn the floor into a wall map[i][j] = WALL; } } @@ -138,7 +144,6 @@ void Border() { - for (int i = 0; i < 84; i++) { for (int j = 0; j < 48; j++) { @@ -154,8 +159,9 @@ void RandFloor(int r) { - for (int space = rand() % 50 + r; space > 0; space--) { + for (int space = rand() % 50 + r; space > 0; space--) { //Iterate code r amount of times + //Randomly generate coordinates int i = rand() % 84; int j = rand() % 48; @@ -168,7 +174,7 @@ void MazeKill() { - + //Array which stores the order in which directions whill be checked int move[4] = { UP, DOWN, LEFT, RIGHT }; bool moved = true; @@ -188,9 +194,10 @@ move[r] = temp; } - - for (int i = 0; i < 3; i++) { + //For (direction) check if there are walls 2 tiles in that directions + //and check that they do not interfere with any part of the maze that has already been built + if (move[i] == UP) { if (map[sx][sy - 1] == WALL && Neighbours(sx, sy - 1) == 1 && map[sx][sy - 2] == WALL && Neighbours(sx, sy - 2) == 0 && sy > 3) { map[sx][sy - 1] = FLOOR; @@ -231,6 +238,7 @@ void Maze() { + //Start in top left corner sx = 1; sy = 1; @@ -248,7 +256,7 @@ end = true; - map[sx][sy] = FLOOR; + map[sx][sy] = FLOOR; //Set current tile to a floor MazeKill(); @@ -261,7 +269,7 @@ sx = i; sy = j; - end = false; + end = false; //If a wall tile in the array has only one neighbouring space that is a floor then more of the maze can be built so the generation has not yet finished } } @@ -284,13 +292,11 @@ DungeonRoomBuilder(); } - - RandFloor(31); Border(); - DeadEnds(50); + DeadEnds(50); //Remove lots of dead ends to make the map less confusing } @@ -302,11 +308,9 @@ FirstRoom(); ExitRoom(); - - RandFloor(151); - DeadEnds(1); + DeadEnds(1); //Only remove some of the dead ends so that the map is still a challenge Border();
--- a/WorldBuilder/WorldBuilder.h Mon May 11 22:03:41 2015 +0000 +++ b/WorldBuilder/WorldBuilder.h Mon May 11 22:25:57 2015 +0000 @@ -146,7 +146,7 @@ /** Border * -* Creates a 1 cell thick border of walls at the extremeties of the map (where the x or y co-ordinates are 0) +* Creates a 1 cell thick border of walls at the extremeties of the map * */ void Border();