Add player movement
This commit is contained in:
parent
269b962fef
commit
3f97e18615
27 changed files with 631 additions and 1 deletions
41
scripts/GeneralControlManager.cs
Normal file
41
scripts/GeneralControlManager.cs
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
using Godot;
|
||||
|
||||
public partial class GeneralControlManager : Node
|
||||
{
|
||||
[Export] Control GameMenu;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Input.MouseMode = Input.MouseModeEnum.Captured;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed("ui_cancel"))
|
||||
{
|
||||
if (GameMenu.Visible)
|
||||
{
|
||||
HideMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMenu();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowMenu()
|
||||
{
|
||||
GameMenu.Show();
|
||||
|
||||
Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
}
|
||||
|
||||
public void HideMenu()
|
||||
{
|
||||
GameMenu.Hide();
|
||||
|
||||
Input.MouseMode = Input.MouseModeEnum.Captured;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue