diff --git a/src/game_state.rs b/src/game_state.rs index 0597d6b15afe31fc68b71764c47cf232b398ccd0..23f0525f0cc4515a05fe3266ccc15a62a117e9dd 100644 --- a/src/game_state.rs +++ b/src/game_state.rs @@ -15,7 +15,7 @@ use tetra::input::{self, Key}; use run::Run; use textures::Textures; use crate::game_state::tile::{Tile, TreasureType}; -use tetra::math::{Vec2, vec2}; +use tetra::math::Vec2; use std::cmp::{min, max}; use std::usize; use rand::{thread_rng, Rng}; @@ -99,31 +99,43 @@ impl State for GameState { impl GameState { fn play_sound_player_attack(&mut self, ctx: &mut Context) { - self.sounds.hit.play(ctx); + if let Err(error) = self.sounds.hit.play(ctx) { + println!("{}", error); + } } fn play_sound_enemy_attack(&mut self, ctx: &mut Context) { - self.sounds.hit.play(ctx); + self.play_sound_player_attack(ctx); } fn play_sound_killed_enemy(&mut self, ctx: &mut Context) { - self.sounds.kill.play(ctx); + if let Err(error) = self.sounds.kill.play(ctx) { + println!("{}", error); + } } fn play_sound_death(&mut self, ctx: &mut Context) { - self.sounds.gameover.play(ctx); + if let Err(error) = self.sounds.gameover.play(ctx) { + println!("{}", error); + } } fn play_sound_chest(&mut self, ctx: &mut Context) { - self.sounds.chest.play(ctx); + if let Err(error) = self.sounds.chest.play(ctx) { + println!("{}", error); + } } fn play_sound_level_up(&mut self, ctx: &mut Context) { - self.sounds.fanfare.play(ctx); + if let Err(error) = self.sounds.fanfare.play(ctx) { + println!("{}", error); + } } fn play_sound_exit(&mut self, ctx: &mut Context) { - self.sounds.exit.play(ctx); + if let Err(error) = self.sounds.exit.play(ctx) { + println!("{}", error); + } } }