Search |
|||
Square tile mapPosted by malenkov on February 24, 2009 at 1:00 AM PST
Many games use graphical maps based in iterative tiles. There are only three regular polygons that can be used as tiles: triangles, squares, and hexagons. Consider the square tiling first. Such tiles are most often used in games because of their ease of processing. Sometimes game developers enable diagonal movement, however, this feature makes calculating distance between two tiles more complicated.
Let me introduce several definitions to be used in further calculations:
Calculating the central point of a tile by its index
Calculating the index of a tile by a point inside
Calculating distance between two tiles
Running the exampleThe following example shows an implementation of the square tiling map. Each tile contains information about its indices and a distance from the selected tile. The source code is available, though, it is not optimal. It is In spite of the fact that I'm inspired by the JavaFX technology, this application has been coded in Java. Unfortunately, JavaFX Script supports sequences, not arrays, which complicates creating two-dimensional arrays required for game development. »
Related Topics >>
Games Comments
Comments are listed in date ascending order (oldest first)
|
|||
|
|