C#: player "dash" function not working only in one direction

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By broslovski

Hi. As title, I have a player char with 8 directional movement which also has a “dash” feature. It works happily in all directions except when both x and y in the velocity are negative. Here’s the code:

using Godot;

public class Player1 : KinematicBody2D
{
	// VARS
	[Signal] delegate void Interacting();
	[Signal] delegate void InventoryChange(string name, int count);
	private Vector2 velocity = new Vector2();
	public bool isDashing = false;
	private Vector2 dirLeft = new Vector2(-1,1);
	private Vector2 dirRight = new Vector2(1,1);
	// METHODS
	public void ChangeInv(string name, int count)
	{
		EmitSignal("InventoryChange", name, count);
	}

	private void GetInput()
	{		
		if(!Globals.cutScene)
		{
			velocity = new Vector2();
			if (Input.IsActionJustPressed("dash") && (!(isDashing)))
			{
				Dash();
			}
			if (Input.IsActionPressed("ui_right"))
			{
				velocity.x = 1;
				FlipR();
			}
			if (Input.IsActionPressed("ui_left"))
			{
				velocity.x = -1;
				FlipL();

			}
			if (Input.IsActionPressed("ui_down"))
			{
				velocity.y = 1;
			}
			if (Input.IsActionPressed("ui_up"))
			{
				velocity.y = -1;
			}
			if (Input.IsActionJustPressed("interact"))
			{
				EmitSignal("Interacting");
			}
			velocity = velocity.Normalized() * Globals.playerspeed;
		}
	}

	async private void Dash()
	{
		isDashing = true;
		Globals.playerspeed = Globals.playerspeed * 3;
		GD.Print(Globals.playerspeed);
        await ToSignal(GetTree().CreateTimer(0.2f), "timeout");
		Globals.playerspeed = Globals.playerspeed / 3;
		GD.Print(Globals.playerspeed);
		isDashing = false;
	}

	private void FlipR()
	{
		GetNode<Sprite>("PlayerAim").Scale = dirRight;
		GetNode<Sprite>("PlayerBody").Scale = dirRight;
		GetNode<CollisionShape2D>("Collision").Scale = dirRight;
	}

	private void FlipL()
	{
		GetNode<Sprite>("PlayerAim").Scale = dirLeft;
		GetNode<Sprite>("PlayerBody").Scale = dirLeft;
		GetNode<CollisionShape2D>("Collision").Scale = dirRight;
	}

	public bool IsMoving()
	{
		return !(velocity.x == 0) && !(velocity.y == 0);
	}

	public override void _PhysicsProcess(float delta)
	{
		GetInput();
		velocity = MoveAndSlide(velocity);
	}

	    public Godot.Collections.Dictionary<string, object> Save()
    {
        return new Godot.Collections.Dictionary<string, object>()
        {
            {"Name", Name},            
            { "Filename", Filename },
            { "Parent", GetParent().GetPath() },
            { "PosX", GlobalPosition.x }, // Vector2 is not supported by JSON
            { "PosY", GlobalPosition.y },
        };
    }
}

I have a Globals script containing

public static int playerspeed = 200;

and a couple of other variables - when the fail to dash happens, the print call doesn’t return the expected “600” while dashing and “200” at the end of the dash (which of course it does with other directions). The player char still moves, it just doesn’t dash.
I’m a bit stumped - any help appreciated. Ta!