I'm an illustrator and pixel artist and I do not know programming at all. I've been studying it specifically to learn how to use Unity and I have no idea of what I'm doing most of the time. All I did so far was by watching YouTube videos and tweaking the code.
So anyways, I managed to make my character jump, double-jump, walk and all the animations seem to be working properly, but the dashing mechanics seems to ignore the speed multiplier. It even plays the dash animation and the trail renderer I told it to play, but the speed remains like the same as if it was just walking. Since I pretty much just copied things I saw other people do and don't quite know what I'm doing, I think my code might be a Frankenstein aberration. But if I'm not wrong it looks like it gets to the point where it triggers the Coroutine, since it plays the dash animation and and the trail renderer. Unity didn't point any errors. So here's the Coroutine I'm using:
private IEnumerator Dash()
{
canDash = false;
isDashing = true;
float originalGravity = rb2d.gravityScale;
rb2d.gravityScale = 0f;
rb2d.velocity = new Vector2(rb2d.velocity.x * dashingPower, 0f);
tr.emitting = true;
yield return new WaitForSeconds (dashingTime);
tr.emitting = false;
rb2d.gravityScale = originalGravity;
isDashing = false;
yield return new WaitForSeconds(dashingCooldown);
canDash = true;
}
Here's the full code for analysis
Thank you all very much in advance!