controller support wip

controller-support
HumanoidSandvichDispenser 2023-08-12 23:18:12 -07:00
parent d762a843f4
commit 1bf37d7afa
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
1 changed files with 10 additions and 1 deletions

View File

@ -50,6 +50,8 @@ public abstract partial class PlayerState : CharacterState
Vector2 mousePos = Character.GetGlobalMousePosition();
Vector2 dirToMouse = Character.GlobalPosition.DirectionTo(mousePos);
Vector2 joystick = Godot.Input.GetVector("look_left", "look_right",
"look_up", "look_down");
if (Character.Inventory.SelectedItem is Items.Weapon weapon)
{
@ -58,7 +60,14 @@ public abstract partial class PlayerState : CharacterState
if (!weapon.ShouldHideIdle || isAttack1On)
{
Character.Target = dirToMouse;
if (joystick.IsZeroApprox())
{
Character.Target = Character.Direction;
}
else
{
Character.Target = joystick;
}
}
if (isAttack1On)