bevy_ldtk
( Tileset from "Cavernas" by Adam Saltsman )
A Bevy plugin for loading LDtk tile maps.
🚧 Maintenance Note: Development of this library by us at @katharostech will be limited to small fixes as we have internally switched to using Bevy Retro and it's LDtk map loader. Still, community pull requests for features or fixes are appreciated!
License
Bevy LDtk is licensed under the Katharos License which places certain restrictions on what you are allowed to use it for. Please read and understand the terms before using Bevy LDtk for your project.
Usage
use *;
use *;
Layers
When the map layers are spawned, the bottommost layer is spawned at the transform coordinate of
the LdtkMapBundle
's Transform
component. Each layer after the bottom layer is placed one
unit higher on the Z axis. To have your sprites for players, etc. appear on top of the rendered
map, their Z axis translation must be higher than the map transform + the layer number that you
want it to appear above.
LDtk Versions
LDtk Version | Plugin Version |
---|---|
0.8.1 | 0.4, 0.5 |
0.7.0 | 0.2, 0.3 |
Bevy Versions
Bevy Version | Plugin Version |
---|---|
0.4 | 0.2, 0.3, 0.4 |
0.5 | 0.5 |
master | not officially supported, but it might work |
Features
- An efficient renderer that only uses 4 vertices per map layer and lays out tiles on the GPU
- Supports hot reload through the Bevy asset server integration
- Heavily commented code to help others who want to see how to make their own tilemap renderers.
Caveats
The plugin is in relatively early stages, but it is still rather functional for many basic maps
- Many features are not supported yet, including:
- tilesets with spacing in them
- levels in separate files
- Occasionally some slight rendering artifacts between tiles. ( #1 ) Not sure what causes those yet. Help from anybody with rendering experience would be greatly appreciated!
Extracting Map Information
You can extract any information necessary for your game from the LDtk JSON map data. Here is an example showing how you could spawn a player.