I wanted to make a top-down 2D platformer game and then I wanted to do something like a dash. I found several tutorials, I made code on the basis of them, but after compilation it gives the following error pls help.
P.S I didn’t know how to paste the code here, because it’s my first time on this forum, I apologize if I pasted it into the thread incorrectly
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public float moveSpeed;
public Rigidbody2D rb;
private Vector2 moveDirection;
private float ActiveMoveSpeed;
public float DashSpeed;
public float DashLenght = .5f, Dashcooldown = 1f;
private float DashCounter;
private float DashCoolCounter;
void Start()
{
ActiveMoveSpeed = MoveSpeed;
}
void Update()
{
ProcessInputs();
}
void FixedUpdate()
{
Move();
}
void ProcessInputs()
{
float moveX = Input.GetAxisRaw("Horizontal");
float moveY = Input.GetAxisRaw("Vertical");
moveDirection = new Vector2(moveX, moveY).normalized;
rb2d.velocity = moveInput * ActiveMoveSpeed;
if (Input.GetKeyDown(KeyCode.Space))
{
if(DashCoolCounter <= && DashCounter <= 0 )
{
ActiveMoveSpeed = DashSpeed;
DashCounter = DashLenght;
}
}
if (DashCounter > 0)
{
DashCounter -= Time.deltaTime;
if (DashCounter <= 0)
{
ActiveMoveSpeed = moveSpeed;
DashCoolCounter = Dashcooldown;
}
}
if (DashCoolCounter > 0)
{
DashCoolCounter -= time.deltaTime;
}
}
void Move()
{
rb.velocity = new Vector2(moveDirection.x * moveSpeed, moveDirection.y * moveSpeed);
}
}