mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-03 15:25:54 +00:00
Player movement and camera
This commit is contained in:
parent
ed656f00bb
commit
a324f2e347
43 changed files with 1777 additions and 316 deletions
|
|
@ -43,11 +43,17 @@ public partial class KeyboardInputProvider : InputProvider
|
|||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
CallDeferred(MethodName.DelayedRegisterGameManager);
|
||||
}
|
||||
|
||||
private void DelayedRegisterGameManager()
|
||||
{
|
||||
if (GameManager.Instance is null)
|
||||
{
|
||||
GD.Print("No GameManager found for keyboard inputprovider");
|
||||
return;
|
||||
}
|
||||
GameManager.Instance.GameStateChange += InstanceOnGameStateChange;
|
||||
_enabled = true;
|
||||
}
|
||||
|
|
@ -107,9 +113,11 @@ public partial class KeyboardInputProvider : InputProvider
|
|||
//if (camera == null) return Vector2.Zero; // Ensure there's a valid camera
|
||||
|
||||
//Vector2 mouseScreenPos = GetViewport().get_local_mouse_position();
|
||||
Vector2 mouseWorldPos = this.GetGlobalMousePosition();
|
||||
if (GameManager.Instance is null) return Vector2.Zero;
|
||||
|
||||
Vector2 mouseWorldPos = DisplayServer.MouseGetPosition();// GameManager.Instance.GetGlobalMousePosition();
|
||||
|
||||
return mouseWorldPos - this.GlobalPosition; // Get direction vector
|
||||
return mouseWorldPos - GameManager.Instance.PlayerPosition.Value; // Get direction vector
|
||||
}
|
||||
|
||||
public override bool GetActionJustPressed(string action)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue