28 lines
573 B
C#
28 lines
573 B
C#
using Godot;
|
|
using Slimepire.Core;
|
|
|
|
namespace Slimepire.Gameplay;
|
|
|
|
public partial class Camera : Camera2D
|
|
{
|
|
[Export]
|
|
public float CameraSpeed = 500;
|
|
|
|
private Vector2 _direction;
|
|
|
|
public override void _UnhandledKeyInput(InputEvent @event)
|
|
{
|
|
_direction = Input.GetVector(
|
|
GameInputMap.CamLeft,
|
|
GameInputMap.CamRight,
|
|
GameInputMap.CamUp,
|
|
GameInputMap.CamDown
|
|
);
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
Position += _direction * CameraSpeed * (float)delta;
|
|
}
|
|
}
|