Check out http://edu.jamsa.fi/~thusu/prog/source/movegame.cpp to get a find out the usage of `old' coordinates - then place this to the `getInput()' (and remember to
Code:
void getInput(void)
{ // Gets player's input
c = getch();
/* where player was */
gotoxy(x+1, y+1); // Silly me...
printf("%c", scr[x][y]);
// Handle movement
if(map[x][y] == WALL)
{ x = oldx; y = oldy; }
// Rest of the specal cases
gotoxy(x, y);
printf("@");
}
> now I have the problem of it exiting after drawing the board.
But, but... changes to `fillArray()' shouldn't affect there. But you might as well clean it up a bit:
Code:
void drawboard(void)
{ // draws player field
int i,j;
printf("\n");
for(i = 0;i < MAXX;i++)
{
for(j = 0;j<MAXY;j++)
{
switch(scr[i][j])
{
case WALL: textcolor(0); break;
...
}
cprintf("%c",scr[i][j]);
}
printf("\n");
}
}
Note the removal of
scr[x][y] = PLAYER;
scr[computerx][computery] = computer;
since the player is now kind of like a layer of its own _on_ the map (I'll leave the implementation of `computer' to a similar system to you).