Compare commits
2 Commits
tilemap
...
c39b6d2120
| Author | SHA1 | Date | |
|---|---|---|---|
| c39b6d2120 | |||
| c0ed58e890 |
18
src/card.rs
18
src/card.rs
@@ -82,6 +82,24 @@ pub struct Card {
|
||||
}
|
||||
|
||||
impl Card {
|
||||
/// Create a new card from the given Cell array
|
||||
pub const fn new(cells: [Cell; 9]) -> Self {
|
||||
Self {
|
||||
cells,
|
||||
nw: false,
|
||||
n: false,
|
||||
ne: false,
|
||||
w: false,
|
||||
e: false,
|
||||
sw: false,
|
||||
s: false,
|
||||
se: false,
|
||||
}
|
||||
}
|
||||
|
||||
// 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