Thread: C++ Knowledge
View Single Post
Old 11-22-2011, 06:54 AM   #13
Phantom Badger
FF's Official Weirdo
 
Phantom Badger's Avatar
 

In-Game Name: [BlackDragonEX - Paladin]
Current Level: [BlackDragonEX - 73]
Server: Teva
Posts: 1,338
Phantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura aboutPhantom Badger has a spectacular aura about
Send a message via MSN to Phantom Badger
Originally Posted by Vasu View Post
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"

Last edited by Phantom Badger; 11-22-2011 at 06:57 AM..
Phantom Badger is offline   Reply With Quote