Added berry sound effects
This commit is contained in:
1 parent
4940701e48
commit
ac284b6d9e
3 files changed
+22
-1
No files matched your search
@@ -123,3 +123,5 @@ vertical_alignment = 1
|
|||||||
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="MusicPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
stream = SubResource("AudioStreamPlaylist_bf53h")
|
stream = SubResource("AudioStreamPlaylist_bf53h")
|
||||||
autoplay = true
|
autoplay = true
|
||||||
|
|
||||||
|
[node name="BerrySoundPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
+18
-1
@@ -26,11 +26,20 @@ public partial class BerryLogic : Node2D {
|
|||||||
Globals.HighScore += ScoreAdder;
|
Globals.HighScore += ScoreAdder;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BerryType == "poison") {
|
AudioStreamPlayer BerrySoundPlayer = GetNode<AudioStreamPlayer>("/root/Game/BerrySoundPlayer");
|
||||||
|
if (BerryType == "normal") {
|
||||||
|
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/Eat.mp3");
|
||||||
|
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 8f;
|
||||||
|
BerrySoundPlayer.Play();
|
||||||
|
} else if (BerryType == "poison") {
|
||||||
Globals.EffectTimer = 0f;
|
Globals.EffectTimer = 0f;
|
||||||
Globals.Score = 0;
|
Globals.Score = 0;
|
||||||
|
|
||||||
BazookaManager.Write(BazookaManager.HighScore, Globals.HighScore.ToString());
|
BazookaManager.Write(BazookaManager.HighScore, Globals.HighScore.ToString());
|
||||||
|
|
||||||
|
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/Death.mp3");
|
||||||
|
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 5f;
|
||||||
|
BerrySoundPlayer.Play();
|
||||||
} else if (BerryType == "slow") {
|
} else if (BerryType == "slow") {
|
||||||
if (Globals.ActiveEffect == "slow") {
|
if (Globals.ActiveEffect == "slow") {
|
||||||
Globals.EffectTimer += 10f;
|
Globals.EffectTimer += 10f;
|
||||||
@@ -39,6 +48,10 @@ public partial class BerryLogic : Node2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Globals.ActiveEffect = "slow";
|
Globals.ActiveEffect = "slow";
|
||||||
|
|
||||||
|
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/Downgrade.mp3");
|
||||||
|
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 0.5f;
|
||||||
|
BerrySoundPlayer.Play();
|
||||||
} else if (BerryType == "ultra") {
|
} else if (BerryType == "ultra") {
|
||||||
if (Globals.ActiveEffect == "ultra") {
|
if (Globals.ActiveEffect == "ultra") {
|
||||||
Globals.EffectTimer += 10f;
|
Globals.EffectTimer += 10f;
|
||||||
@@ -47,6 +60,10 @@ public partial class BerryLogic : Node2D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Globals.ActiveEffect = "ultra";
|
Globals.ActiveEffect = "ultra";
|
||||||
|
|
||||||
|
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/Powerup.mp3");
|
||||||
|
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 0.5f;
|
||||||
|
BerrySoundPlayer.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
QueueFree();
|
QueueFree();
|
||||||
|
|||||||
@@ -19,4 +19,6 @@ public partial class Globals : Node {
|
|||||||
public static int Score = 0;
|
public static int Score = 0;
|
||||||
public static int HighScore = 0;
|
public static int HighScore = 0;
|
||||||
public static bool IsPaused = false;
|
public static bool IsPaused = false;
|
||||||
|
|
||||||
|
public static float SoundEffectVolume = 1f;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user