Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions Assets/Scenes/SingleScenes/SoulPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,20 @@ public override void _PhysicsProcess(double delta)

var mouse = GetViewport().GetMousePosition();

Velocity =
new Vector2(
Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left"),
Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up")
).Normalized() * Speed;

if (Input.IsActionPressed("mousedown"))
{
// Move player by mouse
var direction = (mouse / main.camera.Zoom) - Position;
if (direction.Length() > 1f)
Velocity += direction.Normalized() * Speed;
Velocity = direction.Normalized() * Speed;
}
else
{
// Move player by keyboard or controller
Velocity = new Vector2(
Input.GetActionStrength("ui_right") - Input.GetActionStrength("ui_left"),
Input.GetActionStrength("ui_down") - Input.GetActionStrength("ui_up")
).Normalized() * Speed;
}

MoveAndSlide();
Expand Down