用于处理使用 Tiled 地图编辑器创建的 2D 瓦片地图的辅助工具
bevy_ecs_tiled is a Bevy plugin for working with 2D tilemaps created using the Tiled map editor.
It leverages the official Tiled Rust bindings for parsing and loading Tiled map files, and uses the bevy_ecs_tilemap crate for efficient rendering.
This plugin aims to provide a simple and ergonomic workflow for integrating Tiled into your Bevy 2D games, letting you focus on game design while handling the technical details of map loading, rendering, and entity management.
Visibility and Transform are automatically propagated.Update your Bevy components directly from Tiled editor:
Use several maps to build a huge world:
This crate is documented in three places:
bevy_ecs_tiled book with design explanations, how-to guides and migrations guides.There is notably a FAQ that will hopefully answer most of your questions.
Add the required dependencies to your Cargo.toml file:
[dependencies]
bevy = "0.19"
bevy_ecs_tiled = "0.13"To get started, add the plugin to your app and spawn a map entity.
All you need to do is spawn a TiledMap component with the map asset you want to load (e.g., your map.tmx file).
Make sure this map asset, along with any required dependencies (such as images or tilesets), is present in your local assets folder (by default, ./assets/).
…This simple example will load a map using the default settings.
You can customize how the map is loaded by listening to specific TiledEvent or adding various components to the map entity, such as:
TilemapAnchor — Controls the anchor point of the tilemap.TiledMapLayerZOffset — Adjusts the Z offset between map layers.TiledMapImageRepeatMargin — Control the margin for repeated images.TilemapRenderSettings — Configures rendering options.Transform — Sets the position, rotation, and scale of the map.Visibility — Controls the visibility of the map entity.…For more advanced use cases, such as loading worlds, chunking, custom properties, or integrating with physics, see the examples directory in the repository and notably the demo_platformer.
You can also refer to the API documentation for details on all available components and configuration options.
| bevy | bevy_ecs_tilemap | bevy_ecs_tiled |
|---|---|---|
| 0.19 | 0.19 | 0.13 |
| 0.18 | 0.18 | 0.11 - 0.12 |
| 0.17 | 0.17 | 0.10 |
| 0.16 | 0.16 | 0.7 - 0.9 |
| 0.15 | 0.15 | 0.5 - 0.6 |
| 0.14 | 0.14 | 0.3 - 0.4 |
| 0.13 | main@e4f3cc6 | branch 0.2 |
| 0.12 | 0.12 | 0.1 |
If you can contribute, please do!
If you would like to contribute but don't know where to start, read this section in the book.
This work is licensed under the MIT license.
SPDX-License-Identifier: MIT
暂无开放 Issues,或尚未同步最近议题。