I am currently creating an ASCII based 2d console game as a side project. Currently it works but I am trying to make the camera follow you. Does anyone know a good system for doing this. I have a loop for drawing the entire map but I want the player in the center and the camera to follow.
By the way, I am using my own putchar function for map drawing to the screen.
bool putchar(int screenx, int screeny, int color, char ASCII)
Here is my current map draw code but it needs to be able to center on player.x and player.y
void draw_map(void)
{
int x;
int y;
for( int y = 0; y < MAP_HEIGHT; y++ )
{
for( int x = 0; x < MAP_WIDTH; x++ )
{
putpixel(x,y, block_list.color[mainmap.block[x][y][player.current_floor]],
block_list.image[mainmap.block[x][y][player.current_floor]]);
}
}
}