Pls Help

It says somethings wrong in line 19,41,52,2 and i can figure it out. Much thanks in advance.
Here is the code pls help.

using UnityEngine;
using System.Collections;
public class Player1 : MonoBehaviour
{
    bool jump = false;
    public float speed = 5f;
private float movement = 0f;
private Rigidbody2D rigidBody;
public float jumpSpeed = 8f;

// Use this for initialization
void Start()
{
    rigidBody = GetComponent<Rigidbody2D>();
   
// Update is called once per frame
void Update()
{
        if (input.GetButtondown("Jump"))
        }
            jump = true;
        {


            movement = Input.GetAxis("Horizontal");
    if (movement > 0f)
    {
        rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
    }
    else if (movement < 0f)
    {
        rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
    }
    else
    {
        rigidBody.velocity = new Vector2(0, rigidBody.velocity.y);
    }
    movement = Input.GetAxis("Horizontal");
    if (movement > 0f)
    {
        rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
    }
    else if (movement < 0f)
    {
        rigidBody.velocity = new Vector2(movement * speed, rigidBody.velocity.y);
    }
    else
    {
        rigidBody.velocity = new Vector2(0, rigidBody.velocity.y);
    }
}

Around line 19: input.GetButtondown("Jump") should be Input.GetButtonDown("Jump")

After that, your { and } are reversed! Look at the way all the others are.

        if (input.GetButtondown("Jump"))
        }
            jump = true;
        {
1 Like

Copy and paste the actual errors, not just the line numbers. I can see what the line 19 one is (you have input instead of Input - capitalization matters), but can’t tell what the others are without the error messages.

I can also see that your curly brackets are an absolute mess. You’re missing a } at the end of your Start, lines 20 and 22 seem to be backwards, and probably some other stuff wrong. Having incorrect curly brackets has a tendency to cause a big pile of errors that don’t make sense at first, because the compiler can’t make heads or tails of your code if it isn’t correctly scoped with brackets.

4 Likes