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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
char mapa[100][100] =
{
"###############################################",
"#@ WW#",
"# WWW WW#",
"# WWWW a WW #",
"# WWW # WW #",
"# # # WW #",
"# T # # WW #",
"# T f # B# WW #",
"# ## ## WW #",
"# WW #",
"# T WW #",
"# T T WW #",
"# T T T WW #",
"# T T T T WW #",
"# T TWW T #",
"# p T TWW #",
"# T T T WWT #",
"# T T T WWWWWW #",
"# + T WWWWWWWWWWWW#",
"# WWWWWWWWWWWWW#",
"###############################################"
};
bool stop=false;
//AND HERE IS SOME BASIC EXAMPLE WHICH DIDNT WORK
const int rows = 100 , columns = 100;
for( int i = 0; i < rows; ++i )
{
for( int j = 0; j < columns; ++j )
{
if( mapa[i][j] == 'T' )
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
cout << mapa[i] [j];
}
else
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 8);
cout << mapa[i][j] ;
}
}
}
// IT WOULD BE NICE TO HAVE IT IMPLEMENTED INTO THIS MOVEMENT
//(its from my different game - so different names)
while (stop==false){
system("cls");
for (int y=0; y<20; y++)
{
cout<<mapa[y]<<endl;
}
for (int y=0;y<20;y++)
{
for (int x=0;x<20;x++)
{
switch(mapa[y][x])
{
case '@':
{
system("pause>nul"); if (GetAsyncKeyState(VK_UP)!=0)
{
int y2=(y-1);
switch (mapa[y2][x])
{
case ' ':
{
mapa[y][x]= ' ';
y-=1;
mapa[y2][x]= '@';
}break;
}
}
if(GetAsyncKeyState(VK_DOWN)!=0)
{
int y2=(y+1);
switch(mapa[y2][x])
{
case ' ':
{
mapa[y][x]= ' ';
y+=1;
mapa[y2][x]= '@';
}break;
}
}
if(GetAsyncKeyState(VK_RIGHT)!=0)
{
int x2=(x+1);
switch(mapa[y][x2])
{
case ' ':
{
mapa[y][x]= ' ';
x+=1;
mapa[y][x2]= '@';
}break;
}
}
if(GetAsyncKeyState(VK_LEFT)!=0)
{
int x2=(x-1);
switch(mapa[y][x2])
{
case ' ':
{
mapa[y][x]= ' ';
x-=1;
mapa[y][x2]= '@';
}break;}}}}}}}
|