Basic Movement fixes

This commit is contained in:
Marco Giacomelli 2024-02-26 17:35:40 +01:00
commit c9b3164362
5 changed files with 66 additions and 11 deletions

View file

@ -25,16 +25,16 @@ public partial class PlayerMovement : CharacterBody2D
}
}*/
public void GetInput()
public Vector2 GetInput()
{
Vector2 inputDirection = Input.GetVector("left", "right", "up", "down");
Velocity = inputDirection * Speed;
return Input.GetVector("left", "right", "up", "down");
}
public override void _PhysicsProcess(double delta)
{
GetInput();
var inputDirection = GetInput();
Velocity = inputDirection * (float)(Speed * delta);
MoveAndSlide();
}
}