Add some sfx and loading

This commit is contained in:
Stephen Seo 2019-10-05 10:16:37 +09:00
parent 76d55bf58b
commit a324664276
7 changed files with 22 additions and 3 deletions

View file

@ -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<Sound>,
s_get: Asset<Sound>,
s_power_up: Asset<Sound>,
s_tap: Asset<Sound>,
s_speak_m: Asset<Sound>,
s_speak_f: Asset<Sound>,
timer: f64,
}
impl State for GameState {
fn new() -> Result<Self> {
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(())
}

BIN
static/boom.mp3 Normal file

Binary file not shown.

BIN
static/get.mp3 Normal file

Binary file not shown.

BIN
static/power_up.mp3 Normal file

Binary file not shown.

BIN
static/speak_f.mp3 Normal file

Binary file not shown.

BIN
static/speak_m.mp3 Normal file

Binary file not shown.

BIN
static/tap.mp3 Normal file

Binary file not shown.