diff --git a/Character.h b/Character.h index 747624b..a26164c 100644 --- a/Character.h +++ b/Character.h @@ -19,52 +19,52 @@ public: //void Movement(int Vertical, int Horizontal); void Movement(int Vertical, int Horizontal) - { - int x2 = x + Horizontal; // movement on x-axis - int y2 = y + Vertical; // movement on y-axis +{ + int x2 = x + Horizontal; // movement on x-axis + int y2 = y + Vertical; // movement on y-axis - if (map[x2][y] == ' ') // if player moves horizontally the space before becomes an empty space and the space moved to becomes '@' - { - map[x][y] = ' '; - x += Horizontal; - map[x][y] = '@'; - } - if (map[x2][y] == '.') // if player moves horizontally the space before becomes an empty space and the space moved to becomes '@' - { - map[x][y] = ' '; - x += Horizontal; - map[x][y] = '@'; - } - if (map[x2][y] == 'M') - { - map[x][y] = ' '; - x+=Horizontal; - map[x][y] = '@'; - gold+=rand()%100; - srand (time(NULL)); - } + if (map[x2][y] == ' ') // if player moves horizontally the space before becomes an empty space and the space moved to becomes '@' + { + map[x][y] = ' '; + x += Horizontal; + map[x][y] = '@'; + } + if (map[x2][y] == '.') // if player moves horizontally the space before becomes an empty space and the space moved to becomes '@' + { + map[x][y] = ' '; + x += Horizontal; + map[x][y] = '@'; + } + if (map[x2][y] == 'M') + { + map[x][y] = ' '; + x+=Horizontal; + map[x][y] = '@'; + gold+=rand()%100; + srand (time(NULL)); + } - if (map[x][y2] == ' ') // if player moves vertically the space before becomes an empty space and the space moved to becomes '@' - { - map[x][y] = ' '; - y += Vertical; - map[x][y] = '@'; - } - if (map[x][y2] == '.') // if player moves vertically the space before becomes an empty space and the space moved to becomes '@' - { - map[x][y] = ' '; - y += Vertical; - map[x][y] = '@'; - } - if (map[x][y2] == 'M') - { - map[x][y] = ' '; - y+=Vertical; - map[x][y] = '@'; - gold+=rand()%100; - srand (time(NULL)); - } + if (map[x][y2] == ' ') // if player moves vertically the space before becomes an empty space and the space moved to becomes '@' + { + map[x][y] = ' '; + y += Vertical; + map[x][y] = '@'; } + if (map[x][y2] == '.') // if player moves vertically the space before becomes an empty space and the space moved to becomes '@' + { + map[x][y] = ' '; + y += Vertical; + map[x][y] = '@'; + } + if (map[x][y2] == 'M') + { + map[x][y] = ' '; + y+=Vertical; + map[x][y] = '@'; + gold+=rand()%100; + srand (time(NULL)); + } +} void LevelUp() @@ -110,21 +110,18 @@ class monster int health=6,attack=3,x,y; bool Alive=true; - void getInfo() + void getInfo(int mapX, int mapY) { - for (int j = 0; j < 2; ++j) + for (int j = 0; j < 2; j++) { - x = rand() % 36; + x = rand() % mapX; - y = rand() % 36; + y = rand() % mapY; - j += 1; } - /*std::cout<<"x="; - std::cin>>x; - std::cout<<"y="; - std::cin>>y;*/ } + + void wasAttacked(int *playerattack, int *playerxp, int *playertotalxp) { diff --git a/Roguelike.cpp b/Roguelike.cpp index c29f0c0..5401473 100644 --- a/Roguelike.cpp +++ b/Roguelike.cpp @@ -61,11 +61,8 @@ int main() int mapX, mapY, mapFeatures; mapX=rand()%40 + 10; - //srand (time(NULL)); mapY=rand()%30 + 10; - //srand (time(NULL)); mapFeatures = rand()%20 + 15; - //srand (time(NULL)); Dungeon d(mapX,mapY); d.generate(mapFeatures); for (int i=0; i