1bit-game-jam/scripts/Menu.cs

29 lines
565 B
C#

using Godot;
public partial class Menu : Node2D
{
private Timer _timer;
private AudioStreamPlayer2D _thunderclap;
public override void _Ready()
{
_timer = (Timer)FindChild("Timer");
_thunderclap = (AudioStreamPlayer2D)FindChild("Thunderclap");
GameManager.IsPlaying = false;
}
public override void _Input(InputEvent @event)
{
if (@event.IsActionPressed("ui_confirm") && _timer.IsStopped())
{
_thunderclap.Play();
_timer.Start();
}
}
public void ChangeScene()
{
GetTree().ChangeSceneToFile("res://scenes/main_scene.tscn");
}
}