I’m following Brackeys 2D movement tutorial, and I’m having problems with my code. First of all neither jump or crouch are working, (most concerned about the jumping). And then I also have a compiling error on (30,17) where I’m missing a ; and I cant really find it.
If someone could look through the code and tell me what is wrong that would help a lot, I’ve tried myself but I’m pretty new to coding and Unity.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public CharacterController2D controller;
public float runSpeed = 40f;
float horizontalMove = 0f;
bool jump = false;
bool crouch = false;
// Update is called once per frame
void Update ()
{
horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;
if (Input.GetButtonDown("Jump"))
{
jump = true;
}
if (Input.GetButtonDown("Crouch"))
{
crouch = true;
} ealse if (Input.GetButtonUp("Crouch"))
{
crouch = false;
}
}
void FixedUpdate ()
{
//move our character
controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump);
jump = false;
}
}