StarArawn / bevy_tiled

A plugin for rendering tiled maps.
MIT License
155 stars 40 forks source link

Hexagonal map support ? #22

Open NoelGraf opened 4 years ago

NoelGraf commented 4 years ago

The Tiled Map Editor supports the creation of hexagonal maps. Is it possible to load them ? When I try to load a hexagonal map it is not displayed. Not sure if I am doing something wrong or if this feature is not supported yet.

Kurble commented 4 years ago

Currently, bevy_tiled only supports isometric and orthogonal maps

alice-i-cecile commented 4 years ago

I would also love a hexagonal maps feature :) What needs to be done to get this working?

Kurble commented 4 years ago

I think it comes down to implementing the required project / unproject functions, to get from tile coordinates to screen coordinates and back. I believe this is a bit more difficult for hexagonal maps because they are in a staggered grid with a variable width per row (or variable height column, depending on the orientation).

StarArawn commented 4 years ago

The tiled crate does support hexagon tile maps: https://docs.rs/tiled/0.9.3/tiled/enum.Orientation.html

One would have to figure out how to generate the correct vertex/index positions from the hexagonal tile map data. The change log for tiled map editor also has a bit more info: https://doc.mapeditor.org/en/stable/reference/tmx-changelog/?highlight=hexagonal#tiled-0-11