diff options
author | Tom Barrett <tom@tombarrett.xyz> | 2021-03-21 18:29:09 +0100 |
---|---|---|
committer | Tom Barrett <tom@tombarrett.xyz> | 2021-03-21 18:29:09 +0100 |
commit | 4312f3b7eedbf6cdbe012be6eea1d45afd82de12 (patch) | |
tree | b0ca73f322416edeabfd29a9b48b311bb0ee26e9 /src/cell.rs | |
parent | 965ccb56c4c58066939d74bea22c2a9b59416d0d (diff) |
start using constants for the tilesheet indexes
Diffstat (limited to 'src/cell.rs')
-rw-r--r-- | src/cell.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cell.rs b/src/cell.rs index 6b42fdf..1659289 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -11,7 +11,7 @@ pub enum Occupant { Green, Yellow, Red, - Diamond, + Blue, Explosion, } @@ -24,12 +24,12 @@ impl Default for Occupant { impl Occupant { pub fn to_index(&self) -> u32 { match self { - Occupant::Green => 0, - Occupant::Yellow => 1, - Occupant::Red => 2, - Occupant::Diamond => 3, - Occupant::Explosion => 4, - Occupant::None => 13, + Occupant::Green => constants::TILESHEET_GREEN, + Occupant::Yellow => constants::TILESHEET_YELLOW, + Occupant::Red => constants::TILESHEET_RED, + Occupant::Blue => constants::TILESHEET_BLUE, + Occupant::Explosion => constants::TILESHEET_EXPLOSION1, + Occupant::None => constants::TILESHEET_NONE1, } } } @@ -39,7 +39,7 @@ impl Distribution<Occupant> for Standard { match rng.gen_range(0..=3) { 0 => Occupant::Green, 1 => Occupant::Yellow, - 2 => Occupant::Diamond, + 2 => Occupant::Blue, 3 => Occupant::Red, _ => Occupant::None, } |