I have my class which I want to make a two-dimensional array of.
Public Class SpaceTile
Public Shared TileType As Integer
Public Shared Planet As Integer
Public Shared Occupied As Integer
Public Shared PosX As Integer
Public Shared PosY As Integer
End Class
Public STiles(100,100) As SpaceTile
I initialize each with a loop and:
STiles(x, y) = New SpaceTile
STiles(ctrX, ctrY).TileType = Val(MyLineParts (0))
STiles(ctrX, ctrY).Planet = Val(MyLineParts (1))
STiles(ctrX, ctrY).Occupied = Val(MyLineParts (2))
STiles(ctrX, ctrY).PosX = Val(MyLineParts (3))
STiles(ctrX, ctrY).PosY = Val(MyLineParts (4))
Problem is, it makes all array positions the same. Whenever it makes a new
entry, it and all previous ones are made the same. Anybody have any ideas
here? Thanks!
Public Class SpaceTile
Public Shared TileType As Integer
Public Shared Planet As Integer
Public Shared Occupied As Integer
Public Shared PosX As Integer
Public Shared PosY As Integer
End Class
Public STiles(100,100) As SpaceTile
I initialize each with a loop and:
STiles(x, y) = New SpaceTile
STiles(ctrX, ctrY).TileType = Val(MyLineParts (0))
STiles(ctrX, ctrY).Planet = Val(MyLineParts (1))
STiles(ctrX, ctrY).Occupied = Val(MyLineParts (2))
STiles(ctrX, ctrY).PosX = Val(MyLineParts (3))
STiles(ctrX, ctrY).PosY = Val(MyLineParts (4))
Problem is, it makes all array positions the same. Whenever it makes a new
entry, it and all previous ones are made the same. Anybody have any ideas
here? Thanks!
Comment