Accessing user defined types

BlitzMax Forums/BlitzMax Beginners Area/Accessing user defined types

Is this what you seek to do?

Type Tiles

	Field TileType[20,25] 'Array with mapinfo
	Field TileWidth=100,TileHeight=100
	
End Type


Type Vehicle

	Field X,Y,XTile,YTile

	Method Move()
	EndMethod

	Method CalcTile()
		XTile = Int( X / Map.TileWidth  )' Calculates which MapField or Row we are in
		YTile = Int( Y / Map.TileHeight )' Same but for Y
	EndMethod

End Type 

Const Water = 1
Global Map:Tiles = New Tiles' I guess it's a map
V:Vehicle = New Vehicle
'Later on.. ..in main loop
V.CalcTile

If T.TileType[XTile, YTile] <> Water Then V.Move()