Posted: 29th Oct 2008 19:18
@ErDa
So I used your algorithm and the images paste to the screen but in the wrong position. I recoded your oriinal algorithm because it was giving me an error. I am also using the real map this time instead of the template map that I was just trying to test.
void DrawMaze()
{
if (Level == 1)
{
int maze[19][22] = {
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,8,8,8,8,8,8,8,8,7,8,8,8,8,8,8,8,8,7,
7,9,7,7,8,7,7,7,8,7,7,7,7,7,8,7,7,9,7,
7,8,7,7,8,7,7,7,8,7,8,7,7,7,8,7,7,8,7,
7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,
7,8,7,7,8,7,8,7,7,7,7,7,7,7,8,7,7,8,7,
7,8,8,8,8,7,8,8,8,7,8,8,8,7,8,8,8,8,7,
7,7,7,7,8,7,7,7,0,7,0,7,7,7,8,7,7,7,7,
0,0,0,7,8,7,0,0,0,0,0,0,0,7,8,7,0,0,0,
7,7,7,7,8,7,0,7,7,7,7,7,0,7,8,7,7,7,7,
0,0,0,0,8,0,0,7,0,0,0,7,0,0,8,0,0,0,0,
7,7,7,7,8,7,0,7,7,7,7,7,0,7,8,7,7,7,7,
0,0,0,7,8,7,0,0,0,0,0,0,0,7,8,7,7,7,7,
7,7,7,7,8,7,0,7,7,7,7,7,0,7,8,7,7,7,7,
7,8,8,8,8,8,8,8,8,7,8,8,8,8,8,8,8,8,7,
7,8,7,7,8,7,7,7,8,7,8,7,7,7,8,7,7,8,7,
7,9,8,7,8,8,8,8,8,0,8,8,8,8,8,7,8,9,7,
7,7,8,7,8,7,8,7,7,7,7,7,8,7,8,7,8,7,7,
7,8,8,8,8,7,8,8,8,7,8,8,8,7,8,8,8,8,7,
7,8,7,7,7,7,7,7,8,7,8,7,7,7,7,7,7,8,7,
7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7};
//int template1[12][12] ={
//7,7,7,7,7,7,7,7,7,7,7,7,
//7,8,0,0,0,0,0,0,0,0,0,7,
//7,8,0,0,0,0,0,0,0,0,0,7,
//7,0,0,0,0,9,9,0,0,0,0,7,
//7,0,0,0,0,9,9,0,0,0,0,7,
//7,0,0,9,9,9,9,9,9,0,0,7,
//7,0,0,9,9,9,9,9,9,0,0,7,
//7,0,0,0,0,9,9,0,0,0,0,7,
//7,0,0,0,0,9,9,0,0,0,0,7,
//7,0,0,0,0,0,0,0,0,0,0,7,
//7,0,0,0,0,0,0,0,0,0,0,7,
//7,7,7,7,7,7,7,7,7,7,7,7
//};
dbLoadImage ( "tile.png", 7);
dbLoadImage ( "dot.png", 8);
int mazeX = 0;
int mazeY = 0;
int SpriteID = 7;
const int SizeOfSprite = 30;
//Traverse the rows
while( mazeX < 19)
{
while (mazeY < 22)
{
dbSprite(SpriteID,mazeY * SizeOfSprite ,mazeX * SizeOfSprite,maze[mazeX][mazeY]);
mazeY++;
SpriteID++;
}
if (mazeY == 22)
mazeY = 0;
mazeX++;
}
}
}