Fries
f84479e03a
i added a main menu scene and a score system that is written in GDScript instead of C# for a change. the WallManager, the thing that detects collisions, calls the score method on the ScoreManager.
28 lines
694 B
C#
28 lines
694 B
C#
using Godot;
|
|
|
|
namespace Pong.Scripts.Managers;
|
|
|
|
public partial class MainMenuManager : VBoxContainer
|
|
{
|
|
// Called when the node enters the scene tree for the first time.
|
|
public override void _Ready()
|
|
{
|
|
GetTree().Root.SizeChanged += AdaptUiToScreenResolution;
|
|
AdaptUiToScreenResolution();
|
|
}
|
|
|
|
/// <summary>
|
|
/// code that executes when the start button is pressed. this loads the Pong scene to the root
|
|
/// of the scene tree.
|
|
/// </summary>
|
|
private void OnButtonPressed()
|
|
{
|
|
GetTree().Root.SizeChanged -= AdaptUiToScreenResolution;
|
|
GetTree().ChangeSceneToFile("res://Scenes/Pong.tscn");
|
|
}
|
|
|
|
private void AdaptUiToScreenResolution()
|
|
{
|
|
Size = DisplayServer.WindowGetSize();
|
|
}
|
|
}
|