Add a const OCTAGON and use it in map.rs
We could made a bunch of pre-built Card constatns for all the basic shapes. That way we can `Card::OCTAGON` to create one, instead of typing out the whole function call.
This commit is contained in:
@@ -97,6 +97,9 @@ impl Card {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: The other shapes
|
||||||
|
pub const OCTAGON: Self = Self::new(OCTAGON);
|
||||||
|
|
||||||
/// Produces a new card by stacking another on top of this one.
|
/// Produces a new card by stacking another on top of this one.
|
||||||
pub fn merge(self, top: Self) -> (Self, Option<Self>) {
|
pub fn merge(self, top: Self) -> (Self, Option<Self>) {
|
||||||
let mut new_card = Self::default();
|
let mut new_card = Self::default();
|
||||||
|
|||||||
@@ -11,20 +11,7 @@ pub fn setup_test_tilemap(mut commands: Commands, assets: Res<AssetLibrary>) {
|
|||||||
let map_size = TilemapSize { x: 9, y: 9 };
|
let map_size = TilemapSize { x: 9, y: 9 };
|
||||||
let mut tile_storage = TileStorage::empty(map_size);
|
let mut tile_storage = TileStorage::empty(map_size);
|
||||||
|
|
||||||
let card = Card {
|
let card = Card::OCTAGON;
|
||||||
cells: [
|
|
||||||
Cell::NW,
|
|
||||||
Cell::Filled,
|
|
||||||
Cell::NE,
|
|
||||||
Cell::Filled,
|
|
||||||
Cell::Filled,
|
|
||||||
Cell::Filled,
|
|
||||||
Cell::SW,
|
|
||||||
Cell::Filled,
|
|
||||||
Cell::SE,
|
|
||||||
],
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
add_card_to_tilemap(
|
add_card_to_tilemap(
|
||||||
&card,
|
&card,
|
||||||
|
|||||||
Reference in New Issue
Block a user