I'd write an environment collision function for that:
bool EnvironmentColl(int xpos, int ypos, int width, int height)
{
int i;
for(i = 0; i < environmentobjects; i++)
{ if(xpos = object[i]->dimensions)
if(ypos = object[i]->dimensions)
return true;
}
return false;
}
I brutally simplified that, but if you store the rectangles of walls as objects, then use an array of pointers to those objects to access them all from one collision function, it should be easy to check if the object you're passing into the function is overlapping any of the walls or not. And since this is a loop, you only have to program it for one object and one wall, then it will check all of them.