Hey everyone. I'm new to the forums but couldn't find an "Introduce yourself" board. I suppose it's just as well.
I'm a beginner in VB so I need a little help understanding a concept here.
I'm trying to make a map editor for a 2D tile based game.
the maps can be multi-layered so I'm making a layer array as a structure. The structure contains the width and height of the layer and the tile data in a 2D array.
[code]Public Structure layerType
Public tile(,) As Integer
Public width As Integer
Public height As Integer
Sub New(ByVal i As Integer)
ReDim tile(3, 3)
Public Shared layer() As layerType
Private Sub newMap()
layer(0).width = 1
layer(0).tile(0, 0) = 1 ' Exception goes here?
the first command (layer(0).width = 1) works properly but the second (layer(0).tile(0, 0) = 1) gives me an exception:
Object reference not set to an instance of an object.
I'm pretty sure I've messed up the scope somewhere along the line but I just don't have a tight enough grasp on the language yet to figure it out. Any help would be greatly appreciated.