diff --git a/src/main.rs b/src/main.rs index eded4a1..3e108de 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,16 +2,33 @@ use quicksilver::{ geom::{Circle, Rectangle, Vector}, graphics::{Background::Col, Color}, input::{ButtonState, Key}, - lifecycle::{run, Event, Settings, State, Window}, + lifecycle::{Asset, run, Event, Settings, State, Window}, Result, + sound::Sound, }; use rand::prelude::*; -struct GameState {} +struct GameState { + s_boom: Asset, + s_get: Asset, + s_power_up: Asset, + s_tap: Asset, + s_speak_m: Asset, + s_speak_f: Asset, + timer: f64, +} impl State for GameState { fn new() -> Result { - Ok(Self {}) + Ok(Self { + s_boom: Asset::new(Sound::load("boom.mp3")), + s_get: Asset::new(Sound::load("get.mp3")), + s_power_up: Asset::new(Sound::load("power_up.mp3")), + s_tap: Asset::new(Sound::load("tap.mp3")), + s_speak_m: Asset::new(Sound::load("speak_m.mp3")), + s_speak_f: Asset::new(Sound::load("speak_f.mp3")), + timer: 0.0, + }) } fn event(&mut self, event: &Event, window: &mut Window) -> Result<()> { @@ -19,6 +36,8 @@ impl State for GameState { } fn update(&mut self, window: &mut Window) -> Result<()> { + let dt = window.update_rate(); + self.timer += dt; Ok(()) } diff --git a/static/boom.mp3 b/static/boom.mp3 new file mode 100644 index 0000000..2e1bee0 Binary files /dev/null and b/static/boom.mp3 differ diff --git a/static/get.mp3 b/static/get.mp3 new file mode 100644 index 0000000..ab8cb54 Binary files /dev/null and b/static/get.mp3 differ diff --git a/static/power_up.mp3 b/static/power_up.mp3 new file mode 100644 index 0000000..46a2e25 Binary files /dev/null and b/static/power_up.mp3 differ diff --git a/static/speak_f.mp3 b/static/speak_f.mp3 new file mode 100644 index 0000000..a7c83de Binary files /dev/null and b/static/speak_f.mp3 differ diff --git a/static/speak_m.mp3 b/static/speak_m.mp3 new file mode 100644 index 0000000..764debf Binary files /dev/null and b/static/speak_m.mp3 differ diff --git a/static/tap.mp3 b/static/tap.mp3 new file mode 100644 index 0000000..6172e31 Binary files /dev/null and b/static/tap.mp3 differ