- Home /
Speed Change Doesn't Apply,Why does changing the speed makes the controls wrong
when I change the speed to dashSpeed, every direction works except for when moving bottom right and bottom left. How do you make it so that all 8 direction would work?
private void Update()
{
print(moveInput * dashSpeed);
moveInput.x = Input.GetAxisRaw("Horizontal1");
moveInput.y = Input.GetAxisRaw("Vertical1");
moveInput.Normalize();
if (Input.GetButtonDown("Dash1"))
{
if (dashCoolDown <= 0)
{
isDashing = true;
dashCoolDown = dashCoolDownTime;
}
}
if (dashCoolDown > 0)
{
dashCoolDown -= Time.deltaTime;
}
if (!isDashing)
{
rb.velocity = moveInput * speed;
}
else
{
StartCoroutine(Dash());
}
}
IEnumerator Dash()
{
rb.velocity = moveInput * dashSpeed;
yield return new WaitForSeconds(dashTime);
isDashing = false;
}
,when I change the speed to dashSpeed the change doesn't apply when moving to bottom right or bottom left, it just stays as normal speed
private void Update()
{
print(moveInput * dashSpeed);
moveInput.x = Input.GetAxisRaw("Horizontal1");
moveInput.y = Input.GetAxisRaw("Vertical1");
moveInput.Normalize();
if (Input.GetButtonDown("Dash1"))
{
if (dashCoolDown <= 0)
{
isDashing = true;
dashCoolDown = dashCoolDownTime;
}
}
if (dashCoolDown > 0)
{
dashCoolDown -= Time.deltaTime;
}
if (!isDashing)
{
rb.velocity = moveInput * speed;
}
else
{
StartCoroutine(Dash());
}
}
IEnumerator Dash()
{
rb.velocity = moveInput * dashSpeed;
yield return new WaitForSeconds(dashTime);
isDashing = false;
}
Comment