-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
failed to load free dynotype tileset in absence of proprietary canari…
… tileset
- Loading branch information
1 parent
a2ea724
commit eed4609
Showing
8 changed files
with
364 additions
and
48 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,25 +1,37 @@ | ||
use bevy::prelude::*; | ||
use rand::prelude::*; | ||
use bevy_ecs_tilemap::tiles::TileTextureIndex; | ||
use crate::map::tiles::CANARI_TILES; | ||
use rand::prelude::*; | ||
|
||
use crate::resources::AssetPack; | ||
use self::tiles::DINOTYPE_TILES; | ||
pub mod tiles; | ||
|
||
pub fn random_ground() -> TileTextureIndex { | ||
let mut rng = rand::thread_rng(); | ||
|
||
let ground_tiles = [ | ||
(CANARI_TILES.get("black"), 20), | ||
(CANARI_TILES.get("ground: 1 dot a"), 3), | ||
(CANARI_TILES.get("ground: 1 dot b"), 3), | ||
(CANARI_TILES.get("ground: 2 dots"), 2), | ||
(CANARI_TILES.get("ground: 3 dots a"), 1), | ||
(CANARI_TILES.get("ground: 3 dots b"), 1), | ||
]; | ||
pub fn random_ground(pack: &Res<AssetPack>) -> TileTextureIndex { | ||
let mut rng = rand::thread_rng(); | ||
let index: u32; | ||
|
||
let coordinates = | ||
ground_tiles | ||
if pack.folder_name == "Dinotype" { | ||
let ground_tiles = [ | ||
(DINOTYPE_TILES.get(&' '), 10), | ||
(DINOTYPE_TILES.get(&'.'), 1) | ||
]; | ||
index = 1; /* *ground_tiles | ||
.choose_weighted(&mut rng, |item| { item.1 }) | ||
.unwrap().0.unwrap(); */ | ||
} else if pack.folder_name == "OneBitCanariPack" { | ||
let ground_tiles = [ | ||
(CANARI_TILES.get("black"), 20), | ||
(CANARI_TILES.get("ground: 1 dot a"), 3), | ||
(CANARI_TILES.get("ground: 1 dot b"), 3), | ||
(CANARI_TILES.get("ground: 2 dots"), 2), | ||
(CANARI_TILES.get("ground: 3 dots a"), 1), | ||
(CANARI_TILES.get("ground: 3 dots b"), 1), | ||
]; | ||
let coordinates = *ground_tiles | ||
.choose_weighted(&mut rng, |item| { item.1 }) | ||
.unwrap().0.unwrap(); | ||
|
||
TileTextureIndex((coordinates.0 as u32) + 16 * (coordinates.1 as u32)) | ||
} | ||
index = (coordinates.0 as u32) + 16 * (coordinates.1 as u32); | ||
} else { return TileTextureIndex(0); } | ||
TileTextureIndex(index) | ||
} |
Oops, something went wrong.