Crates.io | bevy_tiles |
lib.rs | bevy_tiles |
version | 0.1.0 |
source | src |
created_at | 2024-03-05 22:54:26.451403 |
updated_at | 2024-04-20 19:43:44.020763 |
description | Bevy library for working with entities in grids. |
homepage | https://github.com/OxidizedGames/bevy_tiles |
repository | https://github.com/OxidizedGames/bevy_tiles |
max_upload_size | |
id | 1164146 |
size | 200,126 |
A general purpose grided entity library meant to support tilemap libraries, or other libraries that require accessing entities in a grid based manner. The goal is to keep the API surface as simple and intuitive as possible, and to avoid deferred operations/states where possible to make the structures more intuitive work with (ex: an update in one system should be seen by the following system, not the following frame when a system has run.).
Currently, bevy_tiles
supports the following:
Upcoming features:
The basic API revolves around TileQuery
's, TileCommands
, and TileMapLabel
's as seen below.
struct GameLayer;
impl TileMapLabel for GameLayer {
const CHUNK_SIZE: usize = 16;
}
fn move_character(
keyboard_input: Res<Input<KeyCode>>,
mut commands: Commands,
character: TileQuery<GameLayer, TileCoord, With<Character>>,
walls: TileQuery<GameLayer, (), With<Block>>,
) {
let mut tile_commands = commands.tiles::<GameLayer, 2>();
let mut x = if keyboard_input.just_pressed(KeyCode::A) {
-1
} else {
0
};
x += if keyboard_input.just_pressed(KeyCode::D) {
1
} else {
0
};
let char_c = character.single();
let new_coord = [char_c[0] + x, char_c[1] + y];
if walls.get_at(new_coord).is_none() {
tile_commands.move_tile(*char_c, new_coord);
}
}
More examples can be found in the examples folder!
Bevy version | bevy_tiles verison |
---|---|
0.13 | 0.2 |
0.12 | 0.1 |
0.11 | 0.1-dev |