From 978752f0f338fe5b21b03642a2b525714c8c39e6 Mon Sep 17 00:00:00 2001 From: Xevion Date: Wed, 23 Jul 2025 17:25:36 -0500 Subject: [PATCH] chore: add index for FruitType sprite --- src/constants.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/constants.rs b/src/constants.rs index 8375c7a..bce7152 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -73,6 +73,19 @@ impl FruitType { FruitType::Key => 5000, } } + + pub fn index(self) -> usize { + match self { + FruitType::Cherry => 0, + FruitType::Strawberry => 1, + FruitType::Orange => 2, + FruitType::Apple => 3, + FruitType::Melon => 4, + FruitType::Galaxian => 5, + FruitType::Bell => 6, + FruitType::Key => 7, + } + } } /// The raw layout of the game board, as a 2D array of characters.