Fixed some berries being too loud
This commit is contained in:
1 parent
0fb849e878
commit
d2607bf99a
1 file changed
+9
-8
@@ -4,9 +4,10 @@ public partial class BerryLogic : Node2D {
|
||||
string BerryType = "";
|
||||
|
||||
void PlaySound(string path, float volume) {
|
||||
var player = new AudioStreamPlayer();
|
||||
player.Stream = (AudioStream)GD.Load(path);
|
||||
player.VolumeDb = Globals.SoundEffectVolume * (volume / 1000);
|
||||
var player = new AudioStreamPlayer {
|
||||
Stream = (AudioStream)GD.Load(path),
|
||||
VolumeDb = Globals.SoundEffectVolume * volume
|
||||
};
|
||||
GetNode<Node2D>("/root/Game").AddChild(player);
|
||||
player.Play();
|
||||
|
||||
@@ -39,14 +40,14 @@ public partial class BerryLogic : Node2D {
|
||||
Globals.Score += ScoreAdder;
|
||||
|
||||
if (BerryType == "normal") {
|
||||
PlaySound("res://Audio/SFX/Eat.mp3", 80f);
|
||||
PlaySound("res://Audio/SFX/Eat.mp3", 0.05f);
|
||||
} else if (BerryType == "poison") {
|
||||
Globals.EffectTimer = 0f;
|
||||
Globals.Score = 0;
|
||||
|
||||
BazookaManager.Write(BazookaManager.HighScore, Globals.HighScore.ToString());
|
||||
|
||||
PlaySound("res://Audio/SFX/Death.mp3", 20f);
|
||||
PlaySound("res://Audio/SFX/Death.mp3", 0.05f);
|
||||
} else if (BerryType == "slow") {
|
||||
if (Globals.ActiveEffect == "slow") {
|
||||
Globals.EffectTimer += 10f;
|
||||
@@ -56,7 +57,7 @@ public partial class BerryLogic : Node2D {
|
||||
|
||||
Globals.ActiveEffect = "slow";
|
||||
|
||||
PlaySound("res://Audio/SFX/Downgrade.mp3", 5f);
|
||||
PlaySound("res://Audio/SFX/Downgrade.mp3", -0.05f);
|
||||
} else if (BerryType == "ultra") {
|
||||
if (Globals.ActiveEffect == "ultra") {
|
||||
Globals.EffectTimer += 10f;
|
||||
@@ -66,7 +67,7 @@ public partial class BerryLogic : Node2D {
|
||||
|
||||
Globals.ActiveEffect = "ultra";
|
||||
|
||||
PlaySound("res://Audio/SFX/Powerup.mp3", 5f);
|
||||
PlaySound("res://Audio/SFX/Powerup.mp3", -0.05f);
|
||||
} else if (BerryType == "speedy") {
|
||||
if (Globals.ActiveEffect == "speedy") {
|
||||
Globals.EffectTimer += 10f;
|
||||
@@ -76,7 +77,7 @@ public partial class BerryLogic : Node2D {
|
||||
|
||||
Globals.ActiveEffect = "speedy";
|
||||
|
||||
PlaySound("res://Audio/SFX/SpeedyPowerup.mp3", 5f);
|
||||
PlaySound("res://Audio/SFX/SpeedyPowerup.mp3", -0.05f);
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
|
||||
Reference in new issue
Block a user