HINT 1
The
Player struct should really be named
Position or something like this.
HINT 2
A solution to the flickering problem would be to redraw only the parts of the map that
actually need redrawing, e.g. the previous and current positions of the game entities.
You can use a
Position array and an integer to hold this information:
1 2
|
Position need_redraw_pos[10];
int need_redraw_count;
|
Then, when you want to redraw these parts, you can simply move the
console cursor on the right position and print the appropriate character.
HINT 3
You can use this to change the console cursor position:
1 2 3 4 5 6 7 8 9
|
void gotoxy(int x, int y)
{
COORD pos;
pos.X = x;
pos.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos);
}
|
Though, you'll probably have to use it like this ->
gotoxy(y,x),
as
your_map_x == console_y and
your_map_y == console_x.
HINT 4
If you want more hints, edit your post and move it to the beginners section.