8 releases

0.3.7 Aug 21, 2024
0.3.6 Aug 14, 2024
0.3.2 Jul 28, 2024
0.1.0 Jul 13, 2024

#126 in Game dev

Download history 93/week @ 2024-07-08 148/week @ 2024-07-15 243/week @ 2024-07-22 215/week @ 2024-07-29 114/week @ 2024-08-05 275/week @ 2024-08-12 149/week @ 2024-08-19 11/week @ 2024-08-26

572 downloads per month

MIT license

68KB
1.5K SLoC

bevy_ecs_tiled

Crates.io docs license Crates.io Following released Bevy versions

Plugin for working with 2D tilemaps created with the Tiled map editor using the bevy_ecs_tilemap crate to perform rendering so each tile is represented by a Bevy entity. Layers are children of the tilemap entity, tiles and objects are children of layers. Visibility is inherited: map -> layer -> tile

screenshot

Features

  • Orthogonal, isometric and hexagonal maps
  • Finite and infinite maps
  • Embedded and separate tileset
  • Easily spawn / despawn maps
  • Animated tiles
  • Rapier and Avian colliders added from tilesets and object layers (rapier or avian feature flag)
  • Tiled custom properties mapped to Bevy components (user_properties feature flag)

Getting started

[dependencies]
bevy = "0.14"
bevy_ecs_tiled = "0.3"
bevy_ecs_tilemap = "0.14"

Then add the plugin to your app:

use bevy::prelude::*;
use bevy_ecs_tiled::prelude::*;
use bevy_ecs_tilemap::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(TilemapPlugin)
        .add_plugins(TiledMapPlugin)
        .add_systems(Startup, startup)
        .run();
}

fn startup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn(Camera2dBundle::default());

    // Ensure any tile / tileset paths are relative to assets/
    let map_handle: Handle<TiledMap> = asset_server.load("map.tmx");
    commands.spawn(TiledMapBundle {
        tiled_map: map_handle,
        ..Default::default()
    });
}

See the examples for more advanced use cases.

Bevy Compatibility

bevy bevy_ecs_tilemap bevy_ecs_tiled
0.14 0.14 0.3
0.13 main@e4f3cc6 branch 0.2
0.12 0.12 0.1

Assets credits

Contributing

If you can contribute, please do!

If you would like to contribute but don't know where to start, read this discussion.

LICENSE

This work is licensed under the MIT license.

SPDX-License-Identifier: MIT

Dependencies

~39–78MB
~1.5M SLoC