init
This commit is contained in:
27
src/Gameplay/Camera.cs
Normal file
27
src/Gameplay/Camera.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user