❔ i need some help with this please the dash is not working

DDanielGGs12/27/2022
private bool canDash = true;
private bool isDashing;
private float dashingPower = 24f;
private float dashingTime = 0.5f;
private float dashingCooldown = 1f;

[SerializeField] private Rigidbody2D rb;
[SerializeField] private Transform GroundCheck;
[SerializeField] private LayerMask groundlayer;
[SerializeField] private TrailRenderer tr;

// Update is called once per frame
void Update()
{
if (isDashing)
{
return;
}


if (Input.GetKeyDown(KeyCode.LeftShift) && canDash)
{
StartCoroutine(Dash());

}

}

flip();
}

private void FixedUpdate()
{
if (isDashing)
{
return;
}
rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
}


private void flip()
{
if (isFacingRight && horizontal < 0f || !isFacingRight && horizontal > 0f)
{
isFacingRight = !isFacingRight;
Vector3 localscale = transform.localScale;
localscale.x = -1f;
transform.localScale = localscale;
}
}

private IEnumerator Dash()
{
canDash = false;
isDashing = true;
float originalgravity = rb.gravityScale;
rb.gravityScale = 0f;
rb.velocity = new Vector2(transform.localScale.x dashingPower, 0f);
tr.emitting = true;
yield return new WaitForSeconds(dashingTime);
rb.gravityScale = originalgravity;
isDashing = false;
yield return new WaitForSeconds(dashingCooldown);
canDash = true;
TTheRanger12/27/2022
debug with Debug.Log method
TTheRanger12/27/2022
see whats being called and whats not being called
TTheRanger12/27/2022
i dont think ur code will compile with that code anyway
rb.velocity = new Vector2(transform.localScale.x dashingPower, 0f);
TTheRanger12/27/2022
u either want transform.localScale.x or dashingPower as the first argument
AAntonC12/27/2022
$code
MMODiX12/27/2022
To post C# code type the following:
```cs
// code here
```

Get an example by typing $codegif in chat

If your code is too long, post it to: https://paste.mod.gg/
AAccord12/28/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.