Need help with code and Compiling error (2D movement)

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;
    }
}

All I read was “I’ve got a compile error but I’m not going to tell you what it is, please guess and get back to me.” :wink:

Have you looked at line 30? I see “ealse” which is a nonsense word. That should be “else”

1 Like

yep the “ealse” was the compile error, English is not my first language, but I still don’t know how I missed it.

Do you have any idea where I went wrong in writing the movement script? (accept the compile error). Since it still wont let me jump or crouch.

Not really but if you have a tutorial then can you not cmopare your code to theirs?

I was just gonna say that I’ve done that for 1 hour straight now, but I just figured out the problem…
I had the “ceilingcheck” in the place where the “groundcheck” was supposed to be located and the other way around.
So it didn’t even have anything to do with the code. Mildly irritated rn
Thank you for your help with the Compiling error though!

1 Like