menu + player
This commit is contained in:
32
script/Menu.cs
Normal file
32
script/Menu.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class Menu : Control
|
||||
{
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
}
|
||||
|
||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
public void ResumeDown()
|
||||
{
|
||||
GetTree().Paused = false;
|
||||
Input.MouseMode = Input.MouseModeEnum.Hidden;
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public void OptionDown()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void ExitDown()
|
||||
{
|
||||
GetTree().Quit();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,10 @@ using System;
|
||||
public partial class Player : CharacterBody2D
|
||||
{
|
||||
[Export] float Speed;
|
||||
|
||||
[ExportGroup("controls")]
|
||||
[Export] Control menu;
|
||||
|
||||
public float PixelSize = 1.0f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
@@ -12,7 +16,9 @@ public partial class Player : CharacterBody2D
|
||||
|
||||
if(Input.IsActionPressed("quit"))
|
||||
{
|
||||
GetTree().Quit();
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
GetTree().Paused= true;
|
||||
menu.Visible = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user