You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
688 B
21 lines
688 B
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
|
|
|
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));
|
|
}
|
|
}
|