Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 PowerControl mbed
Diff: main.cpp
- Revision:
- 18:98ea2b787894
- Parent:
- 17:8790dd599b25
- Child:
- 19:1ab2d83ebffa
--- a/main.cpp Sat May 02 23:51:25 2015 +0000 +++ b/main.cpp Sun May 03 21:29:01 2015 +0000 @@ -59,11 +59,11 @@ { "Sword", 7}, //3 { "Warhammer", 10}, //4 //Armour - { "Cloth armour", 0}, //5 + { "Cloth armour", 1}, //5 { "Leather armour", 2}, //6 - { "Studded armour", 4}, //7 - { "Chainmail vest", 6}, //8 - { "Plate armour", 8}, //9 + { "Studded armour", 3}, //7 + { "Chainmail vest", 4}, //8 + { "Plate armour", 5}, //9 }; struct ENEMIES { @@ -338,8 +338,8 @@ void Maze() { - for(int i = 0; i < 84; i+=2) { - for(int j = 0; j < 48; j+=2) { + for(int i = 1; i < 83; i+=2) { + for(int j = 1; j < 47; j+=2) { if(map[i][j] == WALL) { map[i][j] = FLOOR; @@ -358,13 +358,42 @@ } } +void MazeNew() +{ + sx = 1; + sy = 1; + + //Choose random direction + //Check if 2 cells in direction have no neighbours (excluding current position) + //If true then build and set new current position + //If false chose next direction + + //If cannot move in any direction scan through each cell until there is one which can be built on + //If scan completes END + + int move[4] = {UP, DOWN, LEFT, RIGHT}; + + for(int s = 0; s < 3; s++){ //Shuffle array + + int r = rand()%4; + + int temp = move[s]; + + move[s] = move[r]; + + move[r] = temp; + } + + +} + void DungeonBuilder() { FirstRoom(); ExitRoom(); - int rn = rand()%20 + 10; + int rn = rand()%10 + 6; for(int i = rn; i>0; i--) { DungeonRoomBuilder(); @@ -519,7 +548,7 @@ void Fight() { - int m = rand()%level; + int m = rand()%(level+1); int mh = EnemyList[m].EHealth; @@ -1054,6 +1083,8 @@ World(); LevelScreen(); + + RevealMap(); while(1) { @@ -1082,7 +1113,7 @@ PlayerMove(); - if(rand()%35 == 0) { + if(rand()%50 == 0) { Fight(); }