This seems to work..
SuperStrict Type mapLayer Field width:Int Field height:Int Field id:Int Field name:String Field map:Int[,] Function Create: mapLayer(id:Int, name:String, width:Int, height:Int) Local this: mapLayer = New mapLayer this.id = id this.name = name this.width = width this.height = height this.map = New Int[width, height] Return this End Function End Type Type map Field width:Int=50; Field height:Int=50; Field layers:TList=CreateList(); ' *** CONSTRUCTOR Function Create:map() '*** Works fine here End Function Method addLayer(id:Int,layerName:String) '**** Following line tries To create New layer Object Local layer:mapLayer = New mapLayer.Create(id,layerName,Self.width,Self.height); For Local rep:Int = 1 To 20 layer.map[Rnd(Self.width),Rnd(Self.height)] = 1; Next ListAddLast Self.layers,layer; End Method Method drawMap() 'Field map:Int[50,50]; '**** draw map code For Local layer:mapLayer = EachIn layers Print "Layer : " + layer.name Local s:String For Local y:Int = 0 Until layer.height For Local x:Int = 0 Until layer.width s:+ layer.map[x, y] Next Print s s = "" Next Next End Method End Type Local myMap:map = New Map myMap.addLayer(1, "Bottom") myMap.addLayer(2, "Middle") myMap.addLayer(3, "Top") myMap.drawMap()