my project is to code a maze game and i decided to include some puzzle elements. my group and i decided that we would have characters that have different properties. for example, pushable characters, characters that you can only pass through once, teleporting characters etc. '$' is supposed to be the character that only allows you to pass through it once, then it will turn into '#' which is an immovable wall. however, when i use gotoxy to move to the $ character, and change it to '#', it does change but the player still can pass through it freely. >.<
The code for the change is this :
Code:
if (move == 'd' || move == 'D')
{
if (grid[_y][_x+1] == ' ')
{
gotoxy(_x, _y);
cout << " ";
_x++;
gotoxy(_x, _y);
cout << "@";
}
else if (grid[_y][_x+1] == '$')
{
gotoxy(_x, _y);
cout << ' ';
_x++;
gotoxy(_x,_y);
cout << '#';
_x++;
gotoxy(_x,_y);
cout << '@';
}
else if (grid[_y][_x+1] == '&')
{
gotoxy(_x, _y);
cout << " ";
_x++;
gotoxy(_x,_y);
cout << "^";
_x++;
gotoxy(_x,_y);
cout << "@";
}
}
more info: i have a global char grid[100][100] declared and i used strcopy to copy the text game stages into it. then printing it out with a for loop. help would be greatly appreciated! thanks!