-
Notifications
You must be signed in to change notification settings - Fork 2
technical engine map
The map is the object that represente a city map. This map is rectangular. It contains a certain amount of tiles. Those tiles are arranged as diagonal. Each tile match a single coordinate on the map.
As we can see above, the northest tile start at coordinates (0|0). Going south will increase the ordinate while going west or east will respectively decrease and increase abscissa.
The map size is set in number of tiles. In the image above, the map size is horizontally 23 tiles and vertically 33 tiles.
Note that in our implementation, there is no object representing a tile. The engine is essentially working with coordinates. The map object can tell if a given coordinate is valid (e.i. is included within the map). For example, with our 23x33 sized map, the coordinates (5|4) are not valid since they are outside of the map.
The map pretty much has a single purpose: it contains elements. Each element on the map is set at a particular position (e.i. a particular coordinates). We can distinguish 2 types of element: the static elements and the dynamic elements.
A static element is an element that will never move. It can be destroyed though. A static element has an integer size (in number of tile) and is always positionned at integer coordinates. This mean a static element literally cover one or several tiles, but always cover those tiles entirely. For example, on the image above, the blue area could represent a static element.
A dynamic element however is meant to be moved. It does not have a particular size. But it still has a position, which can be floating coordinates while they are moving from one tile to another. For example a dynamic element moving from (0|0) to (0|1) will eventually pass through coordinates (0|0.25), (0|0.5), etc.