I have just started creating (the oft repeated & much harassed) the pacman game. I have created a 2 - D array, calling it map, that would serve to be my logical grid...
My 2 - D array contains following values :
0 - Empty, 1 - Wall, 2 - Pill, 3 - Ghost, 4 - Pacman
I want to create the grid graphically using information from 'map'...sumthng like where there is a '1' plot pixels & so on...Here's what I did (to create the walls or grid) :
where MAX_SZ is 21 (rows or columns of map) & x & y are my starting point - 99Code:
for(int i = 0; i < MAX_SZ; i++)
x = 99;
for(int j = 0; j < MAX_SZ; j++)
if(map[i][j] == 1)
putpixel(x, y, BLUE);
This code creates a 21 x 21 pixels grid (my animated pacman is bigger than the grid & gobbles it up when it is moved around :mad:)
Can you guys suggest me a better way to do this, as in creating a grid in which each cell is of uniform size (i.e, pixels) ?
I dont intend to use sprites or any other fancy graphics tool - just the graphics header in turbo c (happen to be targetting the dos enviroment).