2025-03-27 23:12:16 +01:00
|
|
|
using Godot;
|
|
|
|
|
|
2025-04-06 18:46:59 +02:00
|
|
|
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
2025-03-27 23:12:16 +01:00
|
|
|
|
|
|
|
|
public partial class Player2D : Node2D
|
|
|
|
|
{
|
|
|
|
|
[Export] private float _speed = 100f;
|
|
|
|
|
|
|
|
|
|
public override void _Process(double delta)
|
|
|
|
|
{
|
|
|
|
|
if (Input.IsActionPressed("move_right"))
|
|
|
|
|
Position = new Vector2(Position.X + (_speed * (float)delta), Position.Y);
|
|
|
|
|
if (Input.IsActionPressed("move_left"))
|
|
|
|
|
Position = new Vector2(Position.X - (_speed * (float)delta), Position.Y);
|
|
|
|
|
if (Input.IsActionPressed("move_up"))
|
|
|
|
|
Position = new Vector2(Position.X, Position.Y - (_speed * (float)delta));
|
|
|
|
|
if (Input.IsActionPressed("move_down"))
|
|
|
|
|
Position = new Vector2(Position.X, Position.Y + (_speed * (float)delta));
|
|
|
|
|
}
|
|
|
|
|
}
|