Says there’s an error in line 45 and line 2. The error is cs1513. Which doesn’t make sense since i have all my curly brackets right.
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()
{
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);
}
}