09-5-2015, 11:24 PM
|
#25
|
Sir Krisk
Join Date: Dec 2007
Location: Vic, Australia
Posts: 930
|
Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)
This is all that's in the initialisation of Tile Map. I took the for-loops out for some reason (clearly I know what I'm doing...) but I still have them saved in a notepad in case I still needed them (which I'm assuming I do since you mentioned it :P). Oh also, I may have been testing a few things with the if statements so that's why they probably contain a tonne of errors in them.
Code:
/*************************************************************************
* Initialise the tile map with appropriate ENTITY values
*/
MAP_BUFFER tileMap;
if (unsigned int row = 0 && 20) //values in row 0 and 20 are set to WALL
{
tileMap[MAP_WIDTH][row] = WALL; //not sure whether I'm supposed to assign an Ascii Code or just set it to WALL
}
else
{
tileMap[MAP_WIDTH][row] = EMPTY; //any other row set to EMPTY
}
if (unsigned int col = 0 && 30) //values in col 0 and 30 are set to WALL
{
tileMap[MAP_HEIGHT][col] = WALL;
}
else
{
tileMap[MAP_HEIGHT][col] = EMPTY; //any other col set to EMPTY
}
Code:
for (unsigned int row = 0; row < MAP_HEIGHT; row++)
{
for (unsigned int col = 0; col < MAP_WIDTH; col++)
{
tileMap[row][col] = WALL;
}
}
__________________
|
|
|