Crate bevy_ecs_tilemap[−][src]
Expand description
A tilemap rendering plugin for bevy which is more ECS friendly by having an entity per tile.
Features
- A tile per entity
- Fast rendering using a chunked approach.
- Layers and sparse tile maps.
- Animations
- Isometric and Hexagonal tile maps
Upcoming Features
Support for isometric and hexagon renderingdoneBuilt in animation support.done see animation example- Texture array support
Layers and add/remove tiles. (High Priority)done
Example
let texture_handle = asset_server.load("tiles.png"); let material_handle = materials.add(ColorMaterial::texture(texture_handle)); // Create map entity and component: let map_entity = commands.spawn().id(); let mut map = Map::new(0u16, map_entity); // Creates a new layer builder with a layer entity. let (mut layer_builder, _) = LayerBuilder::new( &mut commands, LayerSettings::new( UVec2::new(2, 2), UVec2::new(8, 8), Vec2::new(16.0, 16.0), Vec2::new(96.0, 256.0), ), 0u16, 0u16, ); layer_builder.set_all(TileBundle::default()); // Builds the layer. // Note: Once this is called you can no longer edit the layer until a hard sync in bevy. let layer_entity = map_query.build_layer(&mut commands, layer_builder, material_handle); // Required to keep track of layers for a map internally. map.add_layer(&mut commands, 0u16, layer_entity); // Spawn Map // Required in order to use map_query to retrieve layers/tiles. commands.entity(map_entity) .insert(map) .insert(Transform::from_xyz( -128.0, -128.0, 0.0 )) .insert(GlobalTransform::default());
Modules
prelude | use bevy_ecs_tilemap::prelude::*; to import commonly used components, data structures, bundles, and plugins. |
Structs
Chunk | A component that stores information about a specific chunk in the tile map. |
ChunkSettings | Chunk specific settings. |
GPUAnimated | A component that is attached to a Tile entity that tells the GPU how to animate the tile. Currently all frames must be aligned in your tilemap. |
Layer | A component which keeps information and a cache of tile/chunk entities for convenience. |
LayerBuilder | Useful for creating and modifying a layer in the same system. |
LayerBundle | A bevy bundle which contains: Map, Transform, and GlobalTransform components. |
LayerSettings | Various settings used to define the tilemap. |
Map | A simple component used to keep track of layer entities. |
MapQuery | MapQuery is a useful bevy system param that provides a standard API for interacting with tiles. It’s not required that you use this, but it does provide a convenience. Note: MapQuery doesn’t directly change tile components. This is meant as a feature as you may have your own tile data attached to each tile and a standard tile query wouldn’t pull that data in. |
Tile | A component that represents the basic tile information. |
TileBundle | The standard tile bundle. |
TileParent | A component containing the tiles parent information. |
TilemapPlugin | Adds the default systems and pipelines used by bevy_ecs_tilemap. |
TilemapStage | The tilemap stage which runs before post update. |
Enums
HexType | Different hex coordinate systems. You can find out more at this link: https://www.redblobgames.com/grids/hexagons/ |
IsoType | Different iso coordinate systems. |
MapTileError | General errors that are returned by bevy_ecs_tilemap. |
TilemapMeshType | The type of tile to be rendered, currently we support: Square, Hex, and Isometric. |
Traits
TileBundleTrait | This trait is used to allow the layer builder to access specific information inside of the bundle. |