-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add an example to reproduce #28
- Loading branch information
1 parent
9429da0
commit 476e52a
Showing
5 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<tileset version="1.10" tiledversion="1.10.2" name="Tileset2" tilewidth="32" tileheight="32" tilecount="7" columns="0"> | ||
<grid orientation="orthogonal" width="1" height="1"/> | ||
<tile id="0"> | ||
<image width="32" height="32" source="tiles/tile0.png"/> | ||
</tile> | ||
<tile id="1"> | ||
<image width="32" height="32" source="tiles/tile1.png"/> | ||
</tile> | ||
<tile id="2"> | ||
<image width="32" height="32" source="tiles/tile2.png"/> | ||
</tile> | ||
<tile id="3"> | ||
<image width="32" height="32" source="tiles/tile3.png"/> | ||
</tile> | ||
<tile id="4"> | ||
<image width="32" height="32" source="tiles/tile4.png"/> | ||
</tile> | ||
<tile id="5"> | ||
<image width="32" height="32" source="tiles/tile5.png"/> | ||
</tile> | ||
<tile id="6"> | ||
<image width="32" height="32" source="tiles/tile6.png"/> | ||
</tile> | ||
</tileset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="10" height="10" tilewidth="32" tileheight="32" infinite="0" nextlayerid="3" nextobjectid="3"> | ||
<tileset firstgid="1" source="Tileset1.tsx"/> | ||
<tileset firstgid="8" source="Tileset2.tsx"/> | ||
<layer id="1" name="Tile Layer 1" width="10" height="10"> | ||
<data encoding="csv"> | ||
0,0,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,0,0,0, | ||
0,1,0,0,0,0,0,0,0,0, | ||
0,1,0,0,0,0,0,0,0,0, | ||
0,1,0,10,10,10,10,0,0,0, | ||
0,1,0,0,0,0,0,0,0,0, | ||
0,0,0,0,0,0,0,7,0,0, | ||
0,0,0,0,0,0,0,7,0,0, | ||
0,0,12,12,12,12,0,7,0,0, | ||
0,0,0,0,0,0,0,0,0,0 | ||
</data> | ||
</layer> | ||
<objectgroup id="2" name="Object Layer 1"> | ||
<object id="1" name="My object" x="169.544" y="211.836"> | ||
<point/> | ||
</object> | ||
</objectgroup> | ||
</map> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//! This example shows a finite orthogonal map with multiple external tilesets. | ||
use bevy::prelude::*; | ||
use bevy_ecs_tiled::prelude::*; | ||
use bevy_ecs_tilemap::prelude::*; | ||
|
||
mod helper; | ||
|
||
fn main() { | ||
App::new() | ||
.add_plugins(DefaultPlugins) | ||
.add_plugins(TilemapPlugin) | ||
.add_plugins(TiledMapPlugin) | ||
.add_plugins(helper::HelperPlugin) | ||
.add_systems(Startup, startup) | ||
.run(); | ||
} | ||
|
||
fn startup(mut commands: Commands, asset_server: Res<AssetServer>) { | ||
commands.spawn(Camera2dBundle::default()); | ||
|
||
// For simplicity sake, we use two tilesets which actually use the same images | ||
// However, we can verify with the inspector that the map actually use tiles | ||
// from both tilesets | ||
let map_handle: Handle<TiledMap> = asset_server.load("multiple_tilesets.tmx"); | ||
commands.spawn(TiledMapBundle { | ||
tiled_map: map_handle, | ||
..Default::default() | ||
}); | ||
} |