Monday, 19 August 2013

c# array multidimensional or jagged

c# array multidimensional or jagged

I'm drawing a 3x3 grid of squares for a 2D game map.
I want to create an array that has a row and column position and for each
row and column position, it has 4 0's or 1's representing if a wall will
be drawn on that edge of the square.
I want to create this array:
int [,][,,,] Boxes = {{0,0}, {1,0,0,1},
{1,0}, {1,0,1,0},
{0,1}, {0,0,0,1},
{1,1}, {1,1,1,0},
{2,0}, {1,1,0,0},
{2,1}, {0,0,0,1},
{3,1}, {1,0,1,0},
{0,2}, {0,0,1,1},
{1,2}, {1,0,1,0},
{2,2}, {0,1,1,0}};
However, it seems to be not correct.
I have also tried this:
int [][] Boxes = new int [2][4]
Boxes = {{0,0}, {1,0,0,1},
{1,0}, {1,0,1,0},
{0,1}, {0,0,0,1},
{1,1}, {1,1,1,0},
{2,0}, {1,1,0,0},
{2,1}, {0,0,0,1},
{3,1}, {1,0,1,0},
{0,2}, {0,0,1,1},
{1,2}, {1,0,1,0},
{2,2}, {0,1,1,0}};
Is it clear, the type of array i am trying to make?
How would i do this?
Thanks

No comments:

Post a Comment