Originally Posted by Vasu
|
Actually, you can just add a single dimensional array as a property within the "location" class which holds 10 integers, each one corresponding to a particular direction. For example, the array could be:
{N,E,W,S,NE,NW,SE,SW,Up,Down}
For a particular room, the array might read:
{1,0,0,1,0,0,0,0,1,0} which means that he can move north, south and up, but not anywhere else.
|
That was essentially my plan, but surely it would use up less space if I put a string with all those variables in it and then used a sub-string to get the specific character ?
And without a multidimensional array wouldnt all the 'areas' lie across the X axis ? meaning that North/South wouldnt take you anywhere.
EDIT: Since instead of having to initiate all the variables like this:
bool directionUp = true;
bool directionDown = true;
bool directionEast = true;
bool directionNorth = true;
etc...
I could just put
string directionset = "TTTFFT..etc"