1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
// this programme is a function that will control movement in the game map
#ifndef MAP_HPP
#define MAP_HPP
#include <iostream>
#include "windows.h"
#include "character_stats.hpp"
void map(){
using namespace std;
char map [20][60] = {
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"x* xx xxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxx",
"x xx x x xxxxx xxxxxxxx xxxx",
"x xxxxx x xxxxxxxxx xxxxxxxxxxxxxx",
"x xxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxx xxxxxxxxxxxxxx",
"x xxx",
"x xxx xxxxxxxxxxxxxx xxxxxxxxxxx xxx xxxxxxxxxxxxxx",
"x xxx xxx x x xxx xxxxxxxxxxxxxx",
"x xxx xxxxxxx xxxxxxxx xxxxxxxx xxx xxxxxx",
"x xxx xxx xxxxxxx x xxx xxxxxx",
"x xxxxxxxx xxxxxxx xxxxxxxx xxx xxxxxx",
"x xxxxxxx x xxxxxx xxxxxxxxxxx",
"x xxxxxxxxxxxxxxxxxxxxxx xxxxxxxx xxxxxx x",
"x x xxxxxx xxx x x",
"x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx xxx x x",
"x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxx xxx xxxxxxx",
"x xxx x",
"x xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
};
while(HP>0){
system("cls");
for(int display=0; display<20; display++){
cout << map[display] <<endl;
}
system("pause>0");
int x=1;
int y=1;
if(GetAsyncKeyState(VK_DOWN)){
int y2 = y+1;
if(map[y2][x] == ' '){
map[y][x] =' ';
y++;
map[y][x] = '*';}}
if(GetAsyncKeyState(VK_UP)){
int y2 = y-1;
if(map[y2][x] == ' '){
map[y][x] =' ';
y--;
map[y][x] = '*';}}
if(GetAsyncKeyState(VK_RIGHT)){
int x2 = x+1;
if(map[y][x2] == ' '){
map[y][x] =' ';
x++;
map[y][x] = '*';}}
if(GetAsyncKeyState(VK_LEFT)){
int x2 = x-1;
if(map[y][x2] == ' '){
map[y][x] =' ';
x--;
map[y][x] = '*';}}
}
}
#endif
|