I’m using Blackthornprod’s dashing script and it works for him but not for me. I get 5 different errors.
CS9641: ‘else’ cannot start a statement
CS1003: Syntax error, ‘(’ expected
CS1524: Invalid expression term ‘else’
CS1026: ) expected
CS1002: ; expected
I dont know how to fix them please help
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerDash : MonoBehaviour
{
private Rigidbody2D rb;
public float dashSpeed;
private float dashTime;
public float startDashTime;
private int direction;
void Start()
{
rb = GetComponent<Rigidbody2D>();
dashTime = startDashTime;
}
void Update()
{
if(direction == 0)
{
if(Input.GetKeyDown(KeyCode.LeftShift))
{
if(moveInput < 0)
{
direction = 1;
}
else if (moveInput > 0)
{
direction = 2;
}
}
else
{
if(dashTime <= 0)
{
direction = 0;
dashTime = startDashTime;
rb.velocity = Vector2.zero;
}
}
else
{
dashTime -= Time.deltaTime;
if(direction == 1)
{
rb.velocity = Vector2.left * dashSpeed;
}
else if (direction == 2)
{
rb.velocity = Vector2.right * dashSpeed;
}
}
}
}
}