Placeholder music
This commit is contained in:
17
Scripts/BGMPlayer.cs
Normal file
17
Scripts/BGMPlayer.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Godot;
|
||||
|
||||
public partial class BGMPlayer : AudioStreamPlayer
|
||||
{
|
||||
public void SetBGMFromFilepath(string path)
|
||||
{
|
||||
var audioStream = ResourceLoader.Load<AudioStream>(path);
|
||||
if (Stream != audioStream)
|
||||
Stream = audioStream;
|
||||
}
|
||||
|
||||
public void PlayBGM()
|
||||
{
|
||||
if (!Playing)
|
||||
Play();
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,9 @@ public partial class MainMenu : Node2D
|
||||
GetParent().GetNode<TextureRect>("MainMenu/UIAnimations/LoreSplash").Show();
|
||||
_player = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
||||
_player.Queue("IntroLore");
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/02 MovinOn.mp3");
|
||||
bgmPlayer.PlayBGM();
|
||||
}
|
||||
|
||||
private void OnStartButtonPressed()
|
||||
|
||||
Reference in New Issue
Block a user