I’m a beginning to intermediate C++ programmer, so please bear with me.
I am trying to create a maze type program. What I want to do is make a matrix (well, what I’m really trying to make a multidimensional array/vector, but I think a matrix is what I want). But I’m not sure how I can define this.
With arrays you can define them like
vector myVector[3] = { val1 , val2 , val3 };
Which would create a 3 value long array containing val1 val2 and val3 in the first three places respectively.
I want to create a vector for my maze’s map in much the same way, but I can’t figure out how to define a matrix like this.
I want it to be something like:
matrix myMatrix <int> =
{ 0 , 1 , 0 , 0 , 0 }
{ 0 , 1 , 0 , 0 , 0 }
{ 0 , 1 , 0 , 0 , 0 }
{ 0 , 1 , 0 , 0 , 0 }
{ 0 , 1 , 0 , 0 , 0 };
Etc. Where the 0 and 1 values are just the values stored in the matrix (I will use them later to define which spaces you can travel through and which you can’t, and also where the player is and where the goal is.
I guess what I’m really trying to do is represent a tile based world with a matrix. But what I’m having trouble with is defining the initial values; I want them to be easily read in the source code so that I can make maps.
Thanks =)
I get the feeling I’m rambling… Sorry about that.