C# Arrays - Using them to store game level
I'm making a 2D tile based game. I use a 2D jagged array to store an
integer, and the renderer then draws a certain image depending on what
that integer is. I have this part of my code working, however I've come to
a point where I'm not sure how to proceed next.
As the player goes on through the game, I need to be able to store
information about every cell in the 2D array, such as the light level, or
the number of times the user has clicked that cell, or the rotation value
of the image in that cell, or the alpha level for that image, etc etc.
The only way I can think of doing this is to create a 2D array like I have
done previously, for each piece of information I'm using. So for example:
AlphaLevel[][]
NumberOfTimesClicked[][]
And then if I needed (for example) to check the number of times the user
has clicked the cell 5,5 I can do NumberOfTimesClicked[5][5] or if I
needed to set the rotation I could do SetRotation[5][5] = 90.
The thing I'm not sure about is how efficient this is, having an array for
each piece of information doesn't seem that memory efficient.
Is the idea I have a good solution, or is there a better way I haven't
thought about?
Any advice would be great! Thanks
No comments:
Post a Comment