Game Editor: Map data structure

  It's helpful to know how maps are stored in a level. And it's also helpful to know the contents of the map movieClip. Below, I'll show the structure of both.

Key
  (object)
[array]
_[x]
__y =
variable
variable_mc
variable_pic

Map data structure
  It's helpful to know how maps are stored in a level. This object is what you would send to a map to make it draw something.
Since the map can store multiple layers of tiles, the "layer" array contains multiple 2-dimensional arrays, one for each layer. Each 2-dimensional array stores the tiles for that layer. The numbers assigned to the various "y" positions refer to tile image ID's in the chipset. So the map system looks at this number and knows which tile in the chipset to display.
The zeros and ones in the collision array refer to collision ID's. Zero ususally represents open space, and One usually represents walls.
(map)
width = 20__(the map width, in tiles)
height = 15__(the map height, in tiles)
chipset = "chipset/basis.png"
[layers]__(there can be up to 9 layers)
[0]
[x]
y = 214
y = 16
y = 0
(map)
width = 20__(the map width, in tiles)
height = 15__(the map height, in tiles)
chipset = "chipset/basis.png"
[layers]__(there can be up to 9 layers)
[0]
[x]
y = 214
y = 16
y = 0
[1]
[x]
y = 214
y = 16
y = 0
[collision]
[x]
y = 0
y = 0
y = 1
y = 0


Map movieClip structure
  When the map system loads the above data, it'll create a movieClip with the following structure.
It's useful to understand the contents in order to access things like collision data. This movieClip also contains some useful functions, which are explained in the comments at the top of map.as.
(map_mc)
(layer0_mc)
layer0_pic
(layer1_mc)
layer1_pic
width = 20__(the map width, in tiles)
height = 15__(the map height, in tiles)
chipset_pic
[collision_array]
[x]
y = 0
y = 0
y = 1
y = 0


Last updated: June 7, 2011