pub fn load_sprite(&mut self, map: &'a SpriteMap, sprite_str: String) {
        self.sprite = map.map.get(sprite_str.as_str());
        self.item_type = match sprite_str.as_str() {
            //If Weapon
            "weapon_dagger.png" => Some(ItemType::Weapon(EffectOption::Dagger)),
            "weapon_broadsword.png" => Some(ItemType::Weapon(EffectOption::Sword)),
            "weapon_spear.png" => Some(ItemType::Weapon(EffectOption::Spear)),
            // If Heal Item
            "Heart_10.png" => Some(ItemType::Heal(10)),
            "Heart_20.png" => Some(ItemType::Heal(20)),
            _ => None,
        }
    }
/// Loads the sprite by given string from SpriteMap
Loads the sprite by given string from SpriteMap
Loads the sprite by given string from SpriteMap
pub fn load_sprite(&mut self, map: &'a SpriteMap, sprite_str: String) {
        self.sprite = map.map.get(sprite_str.as_str());
        self.item_type = match sprite_str.as_str() {
            //If Weapon
            "weapon_dagger.png" => Some(ItemType::Weapon(EffectOption::Dagger)),
            "weapon_broadsword.png" => Some(ItemType::Weapon(EffectOption::Sword)),
            "weapon_spear.png" => Some(ItemType::Weapon(EffectOption::Spear)),
            // If Heal Item
            "Heart_10.png" => Some(ItemType::Heal(10)),
            "Heart_20.png" => Some(ItemType::Heal(20)),
            _ => None,
        }
    }
pub fn load_sprite ( & mut self , map : & ' a SpriteMap , sprite_str : String ) { self . sprite = map . map . get ( sprite_str . as_str ( ) ) ; self . item_type = match sprite_str . as_str ( ) { //If Weapon " " => Some ( ItemType :: Weapon ( EffectOption :: Dagger ) ) , " " => Some ( ItemType :: Weapon ( EffectOption :: Sword ) ) , " " => Some ( ItemType :: Weapon ( EffectOption :: Spear ) ) , // If Heal Item " " => Some ( ItemType :: Heal ( 10 ) ) , " " => Some ( ItemType :: Heal ( 20 ) ) , _ => None , } }
Loads the sprite by given string from SpriteMap
Loads the sprite by given string from SpriteMap
&mut self
map
&'a SpriteMap
sprite_str
String
&mut self
map
&'a SpriteMap
sprite_str
String