camera movement with WASD. Not working!
This commit is contained in:
@@ -4,10 +4,10 @@ using System;
|
||||
public partial class GobalCamera : Camera2D
|
||||
{
|
||||
public Vector2 zoomSpeed = new Vector2(0.05f, 0.05f);
|
||||
public float zoomMin = 0.001f;
|
||||
public float zoomMax = 2.0f;
|
||||
public float zoomMin = 0.1f;
|
||||
public float zoomMax = 4.0f;
|
||||
[Export] public float dragSensitivity = 0.35f;
|
||||
|
||||
[Export] public float cameraStepSize = 10.0f;
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
@@ -18,6 +18,27 @@ public partial class GobalCamera : Camera2D
|
||||
Position -= mouseMotion.Relative * dragSensitivity / Zoom;
|
||||
}
|
||||
|
||||
if (@event is InputEventAction eventAction && eventAction.IsPressed())
|
||||
{
|
||||
switch (eventAction.AsText())
|
||||
{
|
||||
case "camera_up":
|
||||
Position -= new Vector2(0, cameraStepSize);
|
||||
break;
|
||||
case "camera_down":
|
||||
Position += new Vector2(0, cameraStepSize);
|
||||
break;
|
||||
case "camera_left":
|
||||
Position -= new Vector2(cameraStepSize, 0);
|
||||
break;
|
||||
case "camera_right":
|
||||
Position += new Vector2(cameraStepSize, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
GD.Print(eventAction.AsText());
|
||||
}
|
||||
|
||||
if (@event is InputEventMouseButton mouseButton)
|
||||
{
|
||||
switch (mouseButton.ButtonIndex)
|
||||
|
||||
Reference in New Issue
Block a user