Unexpected symbol

I am currently following a guide on YouTube and have ran into a problem. I made it exactly like the guide did but for some reason I get the message "Unexpected symbol void… "

Completly new to programming btw.

Guide I am following:

Thank you in advance

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    public int playerspeed = 10;
    public bool facingRight = true;
    public int playerJumpPower = 1250;
    public float moveX;
    public bool isGrounded
   

    void Update()
    {
        PlayerMove();
    }

    void PlayerMove()
    {
        //Controls
        moveX = Input.GetAxis("Horizontal");
        if (Input.GetButtonDown("Jump") && isGrounded == true)
        {
            Jump();
        }
       
        //Animation

        // Player Direction
        if (moveX < 0.0f && facingRight == false) {
            FlipPlayer ();
        }
       
        else if (moveX > 0.0f && facingRight == true)
        {
            FlipPlayer();
        }

        //Physics
        {
            gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(moveX * playerspeed, gameObject.GetComponent<Rigidbody2D>().velocity.y);
        }

    }

    void Jump()
    {
        //Jumping Code
        GetComponent<Rigidbody2D>().AddForce (Vector2.up * playerJumpPower);

    }



        void FlipPlayer()
    {
        facingRight = !facingRight;
        Vector2 localScale = gameObject.transform.localScale;
        localScale.x *= -1;
        transform.localScale = localScale;

    }

    void OnCollisionEnter2D(Collision2D col)
    {
        Debug.Log("Player has collided with" + col.collider.name);
    }



}

You have extra brackets at 43-45.

You are missing a semi-colon …

public bool isGrounded
// should be:
public bool isGrounded;
1 Like

That’s actually legal code… though I often think when I see it with some people, it’s an accident. :slight_smile:

1 Like