From ce2e028c728ea2d7aa2a07e8233bce885f3afd5b Mon Sep 17 00:00:00 2001 From: rsninja722 Date: Mon, 26 Apr 2021 17:16:43 -0400 Subject: [PATCH] balancing, stated audio --- src/entities/enemy/jellyfish.rs | 2 +- src/items.rs | 28 ++++++++++++++-------------- src/logic/ingame/playerlogic.rs | 8 +++++++- src/logic/pausemenu.rs | 2 +- src/resources.rs | 13 ++++++------- 5 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/entities/enemy/jellyfish.rs b/src/entities/enemy/jellyfish.rs index 1330bdf..b1fcc80 100644 --- a/src/entities/enemy/jellyfish.rs +++ b/src/entities/enemy/jellyfish.rs @@ -6,7 +6,7 @@ use crate::{ use raylib::prelude::*; use serde::{Deserialize, Serialize}; -const JELLYFISH_STUN_DURATION: f64 = 0.75; +const JELLYFISH_STUN_DURATION: f64 = 1.5; const JELLYFISH_STUN_REACH: f32 = 20.0; #[derive(Debug, Serialize, Deserialize, Default, Clone)] diff --git a/src/items.rs b/src/items.rs index f649bd5..364dc99 100644 --- a/src/items.rs +++ b/src/items.rs @@ -32,25 +32,25 @@ impl StunGun { pub fn lvl1() -> Self { Self { range: 30.0, - duration: 0.75, + duration: 2.0, level: 1, - cost: 30, + cost: 15, } } pub fn lvl2() -> Self { Self { range: 60.0, - duration: 1.25, + duration: 2.5, level: 2, - cost: 40, + cost: 25, } } pub fn lvl3() -> Self { Self { range: 80.0, - duration: 1.0, + duration: 3.0, level: 3, - cost: 50, + cost: 40, } } } @@ -111,14 +111,14 @@ impl AirBag { Self { extra_oxygen: 0.15, level: 1, - cost: 30, + cost: 25, } } pub fn lvl2() -> Self { Self { extra_oxygen: 0.30, level: 2, - cost: 40, + cost: 35, } } pub fn lvl3() -> Self { @@ -186,21 +186,21 @@ impl Flashlight { Self { radius: 0.25, level: 1, - cost: 40, + cost: 20, } } pub fn lvl2() -> Self { Self { radius: 0.5, level: 2, - cost: 50, + cost: 30, } } pub fn lvl3() -> Self { Self { radius: 1.0, level: 3, - cost: 60, + cost: 50, } } } @@ -259,21 +259,21 @@ pub struct Flippers { impl Flippers { pub fn lvl1() -> Self { Self { - speed_increase: 1.2, + speed_increase: 1.1, level: 1, cost: 30, } } pub fn lvl2() -> Self { Self { - speed_increase: 1.5, + speed_increase: 1.2, level: 2, cost: 40, } } pub fn lvl3() -> Self { Self { - speed_increase: 1.8, + speed_increase: 1.3, level: 3, cost: 50, } diff --git a/src/logic/ingame/playerlogic.rs b/src/logic/ingame/playerlogic.rs index 5bb5445..bf194bf 100644 --- a/src/logic/ingame/playerlogic.rs +++ b/src/logic/ingame/playerlogic.rs @@ -1,6 +1,7 @@ +use raylib::core::audio::RaylibAudio; use raylib::prelude::*; -use crate::gamecore::GameCore; +use crate::{gamecore::GameCore, lib::wrappers::audio::player::AudioPlayer}; const NORMAL_PLAYER_SPEED: i32 = 1; const BOOST_PLAYER_SPEED: i32 = NORMAL_PLAYER_SPEED * 2; @@ -11,11 +12,16 @@ const BOOST_DECREASE_PER_SECOND: f32 = 0.65; const BOOST_REGEN_PER_SECOND: f32 = 0.25; const BREATH_DECREASE_PER_SECOND: f32 = 0.02; + + pub fn update_player_movement( draw_handle: &mut RaylibDrawHandle, game_core: &mut GameCore, window_center: Vector2, ) { + + // let mut p: AudioPlayer = AudioPlayer::new(RaylibAudio::init_audio_device()); + // p.play_sound(&game_core.resources.breath); // Calculate DT let dt = draw_handle.get_time() - game_core.last_frame_time; diff --git a/src/logic/pausemenu.rs b/src/logic/pausemenu.rs index 765a1e1..6d265c0 100644 --- a/src/logic/pausemenu.rs +++ b/src/logic/pausemenu.rs @@ -125,7 +125,7 @@ impl Screen for PauseMenuScreen { draw_handle.draw_text( "Credits:\n\t- @ewpratten\n\t- @rsninja722\n\t- @wm-c\n\t- @catarinaburghi\n\t- @kondroel", (win_width / 2) - (SCREEN_PANEL_SIZE.x as i32 / 2) + 10, - (win_height / 2) - (SCREEN_PANEL_SIZE.y as i32 / 2) + 170, + (win_height / 2) - (SCREEN_PANEL_SIZE.y as i32 / 2) + 150, 20, Color::BLACK, ); diff --git a/src/resources.rs b/src/resources.rs index 35b16ac..d14c0b0 100644 --- a/src/resources.rs +++ b/src/resources.rs @@ -1,9 +1,4 @@ -use raylib::{ - math::Vector2, - shaders::Shader, - texture::{Image, RenderTexture2D, Texture2D}, - RaylibHandle, RaylibThread, -}; +use raylib::{RaylibHandle, RaylibThread, audio::Sound, math::Vector2, shaders::Shader, texture::{Image, RenderTexture2D, Texture2D}}; use crate::lib::wrappers::animation::FrameAnimationWrapper; @@ -62,6 +57,9 @@ pub struct GlobalResources { // Treasure pub transponder: FrameAnimationWrapper, + + // Audio + pub breath: Sound, } impl GlobalResources { @@ -155,7 +153,7 @@ impl GlobalResources { )?, Vector2 { x: 20.0, y: 20.0 }, 15, - 4, + 6, ), octopus_animation_regular: FrameAnimationWrapper::new( raylib.load_texture_from_image( @@ -257,6 +255,7 @@ impl GlobalResources { 4, 4, ), + breath: Sound::load_sound("./assets/audio/breath.mp3")? }) } }