A structure is a short hand for one dimension of an array to make access to elements of the array more intuitive
Code:
Dim Type(x, y, z, name)Data
...
Data.x = 0
Data.y = 1
Data.z = 2
Data.name = 3
Is equivalent to
Dim Data(4)
...
x = 0: y = 1: z = 1: name = 3
Data(x) = 0
Data(y) = 1
Data(z) = 2
Data(name) = 3
For an array of strutures
Code:
Dim Type(x, y, z, name)Data(2)
...
Data(0).x = 0
Data(0).Y = 1
Data(0).z = 2
Data(.).name = 3
Is equivalent to
Dim Data(2,4)
...
x = 0: y = 1: z = 1: name = 3
Data(0,x) = 0
Data(0,y) = 1
Data(0,z) = 2
Data(0,name) = 3
In these examples Data is a variable, Dim creates the array and assigns it to the variable. If you want a new array for each Sprite you need to do a Dim for each one to create a new array. The old array still survives if you have assigned it to a Sprite and you can assign it back to the array variable by
Code:
spr1.Value = gw.Sprite1
Data() = spr.DataArray
sprname = Data.name ' or sprname = Data(3)