I can't seem to figure out why it keeps repeating level one anyone got a suggestion on how to fix it?
#include <iostream.h>
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
int mx=14;
int my=1;
int i, j;
char direction = ' ';
char facing = 'S';
char matrix[100][100];
void gotoxy(short x, short y)
{
HANDLE hConsoleOutput;
COORD Cursor_an_Pos = {x,y};
hConsoleOutput = GetStdHandle (STD_OUTPUT_HANDLE);
SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos);
}
void loadlevel(int levelnumber)
{
if(levelnumber == 1)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
strcpy(matrix[0], "----------------------------------------");
strcpy(matrix[1], "| | | | | | | | | |");
strcpy(matrix[2], "| | |---- | | | |-- | ---- | |");
strcpy(matrix[3], "| | | | | | | | | | |");
strcpy(matrix[4], "| ---- |---| | | | --|- | |----| - |");
strcpy(matrix[5], "| | | | | | | | | | | |");
strcpy(matrix[6], "| |----| | -|- |-- | | | --|- | |");
strcpy(matrix[7], "| | | | |");
strcpy(matrix[8], "|-|- ----- | |----- ---|");
strcpy(matrix[9], "| | | | |");
strcpy(matrix[10],"| --- |- | -------- | |");
strcpy(matrix[11],"| | | | | | |");
strcpy(matrix[12],"| | | ---- | | --- |--- |");
strcpy(matrix[13],"| | | | | | | | | | |");
strcpy(matrix[14],"| | | -| | | ---| | | | |");
strcpy(matrix[15],"| | | | | | | | | | |");
strcpy(matrix[16],"|-| |--- | | | |- | --|-- | |");
strcpy(matrix[17],"| | | | | |");
strcpy(matrix[18],"| -- ---| |------ |------- | |");
strcpy(matrix[19],"| | | | | | | | | |");
strcpy(matrix[20],"|--| |--- --- |-----------| |-|-|-| |");
strcpy(matrix[21],"| | | | | |");
strcpy(matrix[22],"| | | -----|- | |");
strcpy(matrix[23],"| | | | | | |");
strcpy(matrix[24],"| -- -----|-|---| | | |");
strcpy(matrix[25],"| | | | | | | ");
strcpy(matrix[26],"| | | | --- |--- --- |-|--- ");
strcpy(matrix[27],"| | | | | | | | ");
strcpy(matrix[28],"| | |-|-| | ------- | -|- |");
strcpy(matrix[29],"| | | | | | | | | | |");
strcpy(matrix[30],"| | | | | | | |----------| | -----|");
strcpy(matrix[31],"| | | | | | | | | |");
strcpy(matrix[32],"| | |---|----| | | --- --|-----| |");
strcpy(matrix[33],"| | | | | |");
strcpy(matrix[34],"|----- | | ----------| ---| |");
strcpy(matrix[35],"| | | | | | |");
strcpy(matrix[36],"|----- | |-| -----| | |");
strcpy(matrix[37],"| | | | | | | |");
strcpy(matrix[38],"| | | | -|- | | |");
strcpy(matrix[39],"| | | | | | |");
strcpy(matrix[40],"| | |--- | ---------| |--|");
strcpy(matrix[41],"| | | | | | | | | |");
strcpy(matrix[42],"| | | | | | |-|-| ----|");
strcpy(matrix[43],"| | | | | | | | |");
strcpy(matrix[44],"| | |-----| |-|- | | ---- |");
strcpy(matrix[45],"| | | | | | | |");
strcpy(matrix[46],"| |----| ------ |--- | | - | |");
strcpy(matrix[47],"| | | | | | | | |");
strcpy(matrix[48]," ------------------------OOO----------- ");
}
}
}
if(levelnumber == 2)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
//The left middle maze section.
strcpy(matrix[0], " ");
strcpy(matrix[1], "------------------------------------------");
strcpy(matrix[2], "| | | | | | | |");
strcpy(matrix[3], "|--- | | ----- | | | | |");
strcpy(matrix[4], "| | | | | | | | | |");
strcpy(matrix[5], "| | | |- | --| -----| | | -----|");
strcpy(matrix[6], "| | | | | | | | |");
strcpy(matrix[7], "| -| |--- | | ----| | | |");
strcpy(matrix[8], "| | | | | | | | | | | |");
strcpy(matrix[9], "| |--- | | | | | | | | | |");
strcpy(matrix[10],"| | | | | | | | | |");
strcpy(matrix[11],"| |--- | ----|- |----| ------| | | |");
strcpy(matrix[12],"| | | | | | |");
strcpy(matrix[13],"| | ----| | | ----| |");
strcpy(matrix[14],"| | | | | | | | | |");
strcpy(matrix[15],"|---| |--- --- | | | | | | |");
strcpy(matrix[16],"| | | | | | | |");
strcpy(matrix[17],"| | | | ------| --- | | --|");
strcpy(matrix[18],"| | | | | | | | | | | |");
strcpy(matrix[19],"| |---|-| | |----| | | | | |");
strcpy(matrix[20],"| | | | | | |");
strcpy(matrix[21],"| | |---- -|---| --------| |");
strcpy(matrix[22],"| | | | | |");
strcpy(matrix[23],"|---| |------ --- | | |");
strcpy(matrix[24],"| | | | | | |");
strcpy(matrix[25],"| | | | | -|--- ------|");
strcpy(matrix[26],"| | | | | | | | |");
strcpy(matrix[27],"| | | ----|-| |------- | | |");
strcpy(matrix[28],"| | | | | | | |");
strcpy(matrix[29],"| |-----| | | | | |");
strcpy(matrix[30],"| | | | | | | | | |");
strcpy(matrix[31],"|-----| |----| | |- | | -------| |");
strcpy(matrix[32],"| | | | | |");
strcpy(matrix[33],"| | ------|- |---| --- --- |");
strcpy(matrix[34],"| | | | | | | |");
strcpy(matrix[35],"| | -- ------| ---| | | | |");
strcpy(matrix[36],"| | | | | | | | | |");
strcpy(matrix[37],"|------| |-|-| ----- | | | |--|");
strcpy(matrix[38],"| | | |");
strcpy(matrix[39],"| ---- ------ | -----| |");
strcpy(matrix[40],"| | | | | | | |");
strcpy(matrix[41],"| | |--- | --------| | ---| |");
strcpy(matrix[42],"| | | | | | |");
strcpy(matrix[43],"|---- ---| | |-------| |-- |");
strcpy(matrix[44],"| | | | |");
strcpy(matrix[45],"| -- --- |-| ----- ---| -----|");
strcpy(matrix[46],"| | | | | | |");
strcpy(matrix[47],"| | | | |--- | |");
strcpy(matrix[48],"| | | | | | | |");
strcpy(matrix[49],"| | ------|-------- | | | |----|");
strcpy(matrix[50],"| | | | | | |");
strcpy(matrix[51],"| | | |- | ------ -----|--------- |");
strcpy(matrix[52],"| | | | | | | |");
strcpy(matrix[53]," --------------------OOOOO--------------- ");
}
}
}
if(levelnumber == 3)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
strcpy(matrix[0], " ");
strcpy(matrix[1], " ------------------------------------------------- ");
strcpy(matrix[2], "| | | | |-----| | | | | | | |");
strcpy(matrix[3], "| | | | | -- | | | | | ----|");
strcpy(matrix[4], "| | | | |--------| | | | | | | |");
strcpy(matrix[5], "|- |---| | ---- | |--- | --| | | | |");
strcpy(matrix[6], "| | | | | | | | |");
strcpy(matrix[7], "| | -- | | --|- | - | | -----|");
strcpy(matrix[8], "| | | | | | | | |");
strcpy(matrix[9], "| |-- - ---- --| -| | | ----| | |");
strcpy(matrix[10],"| | | | | | | | | |");
strcpy(matrix[11],"| -- | |-- --| ------| | | --| --|- |");
strcpy(matrix[12],"| | | | | | | | | |");
strcpy(matrix[13],"| | |---| | | ------| ----| -|----|");
strcpy(matrix[14],"| | | | | | | | |");
strcpy(matrix[15],"| |---| | |-- -|-- |- ---| ----|");
strcpy(matrix[16],"| | | | | | | | | |");
strcpy(matrix[17],"| | | | | -----| | | | --- ------|");
strcpy(matrix[18],"| | | | | | | | | | | | | |");
strcpy(matrix[19],"| -|- | | ---|-- | | | |--|- | | | |");
strcpy(matrix[20],"| | | | | | | | | | | | | |");
strcpy(matrix[21],"| | | --| --| | | | | | | -| | |");
strcpy(matrix[22],"| | | | | | | | | | | | |");
strcpy(matrix[23],"|---- | | |-|-| | | | -- | | | |");
strcpy(matrix[24],"| | | | | | | | | | |");
strcpy(matrix[25],"|- | -| -- | | --|---| | |-- --|-- |");
strcpy(matrix[26],"| | | | | | | | | | |");
strcpy(matrix[27],"|- | ----|---- | -|- -| | |- |----- |-|");
strcpy(matrix[28],"| | | | | | | |");
strcpy(matrix[29],"|- --|--- | | |- - -----| | |");
strcpy(matrix[30],"| | | | | | | | | | | |");
strcpy(matrix[31],"| |--| | |-|- | | -| | |-- |");
strcpy(matrix[32],"| | | | | | | | | | | |");
strcpy(matrix[33],"| |-| | -|--- |---| | ---| | | |");
strcpy(matrix[34],"| | | | | | | | |");
strcpy(matrix[35],"| | -- --|-| --- --- | | |--|-|");
strcpy(matrix[36],"| | | | | | | | | | | |");
strcpy(matrix[37],"| | | | --|-| | | |---|-- |-- |");
strcpy(matrix[38],"| | | | | | | | | | | |");
strcpy(matrix[39],"| | | --|- -----| | | | | |------- | |");
strcpy(matrix[40],"| | | | | | | | | | | | |");
strcpy(matrix[41],"| | | | |-| |-| |--| ------ | --| |");
strcpy(matrix[42],"| | | | | | | | | | | | |");
strcpy(matrix[43],"|- | |-| | | | |-- | |------- | |------|");
strcpy(matrix[44],"| | | | | | | | | | | | |");
strcpy(matrix[45],"| |- -|--- | | ---|- | | --| | | | |");
strcpy(matrix[46],"| | | | | | | | | | | |");
strcpy(matrix[47],"| | | | |---| --|---| | | | |");
strcpy(matrix[48],"| | | | | | | | |");
strcpy(matrix[49]," ----------OOO------------------------------------ ");
}
}
}
if(levelnumber == 4)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
//The top right maze section.
strcpy(matrix[0], " ");
strcpy(matrix[1], " ------------------------------------------ ");
strcpy(matrix[2], "| | | | | | | |");
strcpy(matrix[3], "|--- | | | | | | |");
strcpy(matrix[4], "| | | | | | | | |");
strcpy(matrix[5], "| | |-- |-- | |- | | -------------|");
strcpy(matrix[6], "| | | | | | | | | |");
strcpy(matrix[7], "| | | --------- | | -| | | --- | |");
strcpy(matrix[8], "| | | | | | | |");
strcpy(matrix[9], "| |---| |-- -- -----| | | |");
strcpy(matrix[10], "| | | | | | |");
strcpy(matrix[11],"| | |-- | | | |");
strcpy(matrix[12],"| | | | | | | | |");
strcpy(matrix[13],"|-| --- | |---| |------|--- | |");
strcpy(matrix[14]," | | | | | | |");
strcpy(matrix[15]," -|-- | | | | |--- |");
strcpy(matrix[16]," | | | | | | |");
strcpy(matrix[17]," - | | ------|--- | ----| | |");
strcpy(matrix[18],"| | | | | | |");
strcpy(matrix[19],"| | -- | | ------- |------- | |");
strcpy(matrix[20],"| | | | | | | | | |");
strcpy(matrix[21],"| |-|-| | -| -- | |-----| |");
strcpy(matrix[22],"| | | | | | | | | |");
strcpy(matrix[23],"| |-------- |-| | | ----|-- | --|-- |");
strcpy(matrix[24],"| | | | | | |");
strcpy(matrix[25],"| | --------| | | | --|");
strcpy(matrix[26],"| | | | | | | | | |");
strcpy(matrix[27],"| | | -- | |--- | --| -|-| |");
strcpy(matrix[28],"| | | | | | |");
strcpy(matrix[29],"| ---|- | |------| ------- --- | -|");
strcpy(matrix[30],"| | | | | | | | |");
strcpy(matrix[31],"| |- |- | |- | | | |");
strcpy(matrix[32],"| | | | | | | |");
strcpy(matrix[33],"|----- | |- | --- | | -| |");
strcpy(matrix[34],"| | | | | | | |");
strcpy(matrix[35],"|- |--- | -------| | -| | -----|");
strcpy(matrix[36],"| | | | | | | | |");
strcpy(matrix[37],"| | |-| | --- | | - -| |");
strcpy(matrix[38],"| | | | | | | | | | | |");
strcpy(matrix[39],"| |- --| | | | | | |---- -| | |");
strcpy(matrix[40],"| | | | | | | | | |");
strcpy(matrix[41],"| | | | | -| |--- ---| | |");
strcpy(matrix[42],"| | | | | | | | | |");
strcpy(matrix[43],"| | | | | ---| | |---|--|");
strcpy(matrix[44],"| | | | | | | | | | | | |");
strcpy(matrix[45],"| | | | | | | | --- | -| | | |");
strcpy(matrix[46],"| | | | | | | | | | |");
strcpy(matrix[47],"| |---| | |---| | | | -|-- ----|");
strcpy(matrix[48],"| | | | | | |");
strcpy(matrix[49]," -----------------------OOO---------------- ");
}
}
}
if(levelnumber == 4)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
//center center maze.
strcpy(matrix[0], " ");
strcpy(matrix[1], " -------------------------------------------------- ");
strcpy(matrix[2], "| | | | | | | | |");
strcpy(matrix[3], "| | | |------ --- |--- -|-- | | ---|");
strcpy(matrix[4], "| | | | | | | | | | |");
strcpy(matrix[5], "| ------ | | | |---| | | -|---- | |");
strcpy(matrix[6], "| | | | | | | | | | | |");
strcpy(matrix[7], "| | --- | | | --- | --- | | | | | -----|");
strcpy(matrix[8], "| | | | | | | | | | | | | | | | |");
strcpy(matrix[9], "| | | | | |-|--|- | | | -----|---|-| | | |");
strcpy(matrix[10],"| | | | | | | | | | | | | | |");
strcpy(matrix[11],"| | | | | | | | |--|- | | ------| | |");
strcpy(matrix[12],"| | | | | | | | | | | |");
strcpy(matrix[13],"| | | |-|-| | | |- |--- | |");
strcpy(matrix[14],"| | | | | | | | | | |");
strcpy(matrix[15],"| | | | | |----- ---| | ----|-----| |");
strcpy(matrix[16],"| | | | | | | | | | |");
strcpy(matrix[17],"| | | | | | | ---|-- |-| |");
strcpy(matrix[18],"| | | | | | | | | | |");
strcpy(matrix[19],"| | | | | | | | -- | | |");
strcpy(matrix[20],"| | | | | | | | | | | |");
strcpy(matrix[21],"| | | | | | |--|-- | | |--- -------- |");
strcpy(matrix[22],"| | | | | | | | | | | | | |");
strcpy(matrix[23],"| |-----| | | | | | | | | | | |");
strcpy(matrix[24],"| | | | | | | | | | |");
strcpy(matrix[25],"|-------- |------------|-| | | ---|---| |- |---|");
strcpy(matrix[26],"| | | | | | | | | |");
strcpy(matrix[27],"| ----- | | --------|-|-| | | | |");
strcpy(matrix[28],"| | | | | | | | | | | | |");
strcpy(matrix[29],"| |-| | -| | -- | | | | | | |");
strcpy(matrix[30],"| | | | | | | | | | |");
strcpy(matrix[31],"| ----| --- | | | --| | ---- ---| | |-|");
strcpy(matrix[32],"| | | | | | | | | | | | |");
strcpy(matrix[33],"| | |-|- | |---| ----- | | -| | | --|");
strcpy(matrix[34],"| | | | | | | | | |");
strcpy(matrix[35],"| |--- -----| | | | --| ---| - |- |");
strcpy(matrix[36],"| | | | | | | | | | | | |");
strcpy(matrix[37],"|----- | |-| |--- |-|-| | --| | | - |");
strcpy(matrix[38],"| | | | | | | | | | | |");
strcpy(matrix[39],"| | |-|---|-- |- | | | -|---- | |");
strcpy(matrix[40],"| | | | | | | | | | |");
strcpy(matrix[41],"|-| -| -- -- --| --- |--| | -- | -| |-- |");
strcpy(matrix[42],"| | | | | | | | |");
strcpy(matrix[43],"| | | | |-|--- ----- | | |");
strcpy(matrix[44],"| | | | | | | | | | | | |");
strcpy(matrix[45],"| --|- |--- | | |-|-| | | | | |");
strcpy(matrix[46],"| | | | | | | | | | | | | |");
strcpy(matrix[47],"|--| ---- | |--| | | | |------|- |-| | |");
strcpy(matrix[48],"| | | | | | | | | | |");
strcpy(matrix[49],"| | | | --- | | ----|-| --------| | |");
strcpy(matrix[50],"| | | | | | | | | | | | | | | |");
strcpy(matrix[51],"| |-|-| | |--| | |--| |-- --| | | -------|-|");
strcpy(matrix[52],"| | | | | | | |");
strcpy(matrix[53]," -----------------------------------OOO------------ ");
}
}
}
if(levelnumber == 4)
{
for(i=0; i<60; i++)
{
for(j=0; j<60; j++)
{
//Center right maze.
strcpy(matrix[0], " ");
strcpy(matrix[1], " -------------------------------------------- ");
strcpy(matrix[2], "| | | | |");
strcpy(matrix[3], "|--- --- ----| | ---|----- |");
strcpy(matrix[4], "| | | | | | | | | | |");
strcpy(matrix[5], "|----| | | | - --| | |--- | | |");
strcpy(matrix[6], "| | | | | | | | | |");
strcpy(matrix[7], "|------| -| |-- |- | | ---| | |");
strcpy(matrix[8], "| | | | | | | | | |");
strcpy(matrix[9], "| | | -| --- |----| |------------| | |");
strcpy(matrix[10],"| | | | | | |");
strcpy(matrix[11],"| | | --- | |---------- ----| |");
strcpy(matrix[12],"| | | | | | | | | |");
strcpy(matrix[13],"| |-| | |------- | -|-| | |");
strcpy(matrix[14],"| | | | | | | | | | |");
strcpy(matrix[15],"|- |--- | --- | | |-| |--| | |");
strcpy(matrix[16],"| | | | | | | | |");
strcpy(matrix[17],"| | --- | -|---|-| | -| |");
strcpy(matrix[18],"| | | | | | | | | |");
strcpy(matrix[19],"| | | |------|-|-| -- ---| | |");
strcpy(matrix[20],"| | | | | | | | | |");
strcpy(matrix[21],"| | | |----- |------ |- | | |---- |");
strcpy(matrix[22],"| | | | | |");
strcpy(matrix[23],"| |- ----- ---| |--- | |");
strcpy(matrix[24],"| | | | | | |");
strcpy(matrix[25],"|---- -| ----- | | |- | ------|");
strcpy(matrix[26],"| | | | | | | | |");
strcpy(matrix[27],"| --| ---|- | | ---| |--------| |");
strcpy(matrix[28],"| | | | | | | | | | |");
strcpy(matrix[29],"| | | |---| | | |-- | | |");
strcpy(matrix[30],"| | | | | | | |");
strcpy(matrix[31],"|------| --| |-----| | --- | --|");
strcpy(matrix[32],"| | | | | | | |");
strcpy(matrix[33],"| ---- | ---| |---| | | |");
strcpy(matrix[34],"| | | | | | |");
strcpy(matrix[35],"| ----- -| | ----- | | --|--- |");
strcpy(matrix[36],"| | | | | | |");
strcpy(matrix[37],"| | ----- |------ | | |------ -|");
strcpy(matrix[38],"| | | | | | | |");
strcpy(matrix[39],"| | |---------- | ---| | | ----|");
strcpy(matrix[40],"| | | | | | | | | | | |");
strcpy(matrix[41],"|-|-| --- | | | -| |- --|-| | |");
strcpy(matrix[42],"| | | | | | | | | | |");
strcpy(matrix[43],"|--- --| |--|---| |-------| -|-| | |");
strcpy(matrix[44],"| | | | | |");
strcpy(matrix[45],"| --- | ------- | --------- -| |- |");
strcpy(matrix[46],"| | | | | | | | |");
strcpy(matrix[47],"| | | | --- | | | ----- --- | |");
strcpy(matrix[48],"| | | | | | | | | | |");
strcpy(matrix[49],"| | ----| - | | -----|--- | |- | | |");
strcpy(matrix[50],"| | | | | | | | |");
strcpy(matrix[51],"|-- ------| | | | --- ---|--- | |-|");
strcpy(matrix[52],"| | | | | | | | |");
strcpy(matrix[53]," -------------- --------------------------- ");
}
}
}
}
void printgrid()
{
for (int i=0; i<60; i++)
{
for ( int j=0; j<60; j++)
{
printf("%c", matrix[i][j]);
}
printf("\n");
}
}
void changelevel(int ¤tlevel)
{
int clear = 0;
if(currentlevel == 1 && matrix[my][mx+1] == 'O' && facing == 'S'||'A'||'D'||'W' && my == 48 && mx == 26||27||28)
{
currentlevel = 2;
my = 1;
mx = 14;
clear = 1;
}
if(currentlevel == 2 && matrix[my][mx+1] == 'O' && facing == 'S' && my == 53 && mx == 22||23||24||25||26)
{
currentlevel = 3;
my = 2;
mx = 14;
clear = 1;
}
if(currentlevel == 3 && matrix[my][mx+1] == 'O' && facing == 'S' && my == 49 && mx == 12||13||14)
{
currentlevel = 4;
my = 2;
mx = 14;
clear = 1;
}
if(currentlevel == 4 && matrix[my][mx+1] == 'O' && facing == 'S' && my == 49 && mx == 25||26||27)
{
currentlevel = 5;
my = 2;
mx = 14;
clear = 1;
}
if(currentlevel == 5 && matrix[my][mx+1] == 'O' && facing == 'S' && my == 53 && mx == 38||39||40)
{
currentlevel = 6;
my = 2;
mx = 14;
clear = 1;
}
if(currentlevel == 6 && matrix[my][mx-5] == 'O' && facing == 'S' && my == 53 && mx == 16||17||18)
{
currentlevel = 1;
my = 2;
mx = 14;
clear = 1;
}
if(clear == 1)
{
loadlevel(currentlevel);
system("cls");
printgrid();
gotoxy(mx,my);
printf("@");
gotoxy(0, 0);
gotoxy(0, 21);
}
}
int main()
{
int level = 1;
system("COLOR 0B");
loadlevel(level);
printgrid();
gotoxy(mx,my);
printf("@");
gotoxy(0, 0);
gotoxy(0, 21);
while (mx>0 && my>0)
{
loadlevel(level);
if (kbhit())
{
direction=getch();
if ((direction == 'd') || (direction == 'a') || (direction == 'w') || (direction == 's') || (direction == 'S') || (direction == 'D') || (direction == 'A') || (direction == 'W') || (direction == 'e') || (direction == 'E'))
{
if (direction == 's' || direction == 'S')
{
gotoxy(mx,my);
printf("@");
facing = 'S';
if(matrix[my+1][mx] == ' ')
{
gotoxy(mx,my);
printf(" ");
my++;
gotoxy(mx,my);
printf("@");
}
}
if (direction == 'w' || direction == 'W')
{
gotoxy(mx,my);
printf("@");
facing = 'W';
if(matrix[my-1][mx] == ' ')
{
gotoxy(mx,my);
printf(" ");
my--;
gotoxy(mx,my);
printf("@");
}
}
if (direction == 'a' || direction == 'A')
{
gotoxy(mx,my);
printf("@");
facing = 'A';
if(matrix[my][mx-1] == ' ')
{
gotoxy(mx,my);
printf(" ");
mx--;
gotoxy(mx,my);
printf("@");
}
}
if (direction == 'd' || direction == 'D')
{
gotoxy(mx,my);
printf("@");
facing = 'D';
if(matrix[my][mx+1] == ' ')
{
gotoxy(mx,my);
printf(" ");
mx++;
gotoxy(mx,my);
printf("@");
}
}
if(direction == 'e' || direction == 'E')
{
changelevel(level);
}
direction = ' ';
gotoxy(0,21);
}
}
}
return 0;
}