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.
|
||||
pub fn merge(self, top: Self) -> (Self, Option<Self>) {
|
||||
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 mut tile_storage = TileStorage::empty(map_size);
|
||||
|
||||
let card = Card {
|
||||
cells: [
|
||||
Cell::NW,
|
||||
Cell::Filled,
|
||||
Cell::NE,
|
||||
Cell::Filled,
|
||||
Cell::Filled,
|
||||
Cell::Filled,
|
||||
Cell::SW,
|
||||
Cell::Filled,
|
||||
Cell::SE,
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
let card = Card::OCTAGON;
|
||||
|
||||
add_card_to_tilemap(
|
||||
&card,
|
||||
|
||||
Reference in New Issue
Block a user