Hey there,
I have started working on a 2D Racing Game with motors. Now i started on the script for the moving of the motorcycle and came across a few errors that i cant seem to get fixed. Bare in mind, Im a beginner so all positive answers are welcome.
The errors i get:
CS1519: Unexpected symbol ‘void’ in class,struct or interface member declaration.
CS1525: Unexpected symbol ‘CharacterController’.
This is the code:
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(CharacterController))]
public class FirstPersonController : MonoBehaviour {
public float MovementSpeed = 4.0f;
public float RotationSpeed = 2.5f;
float VerticalVelocity = 0f;
CharacterController CharacterController
// Use this for initialization
void Start () {
Screen.lockCursor = true;
CharacterController = GetComponent();
}
// Update is called once per frame
void Update () {
// Rotation
float rotUpDown = Input.GetAxis(“Mouse Y”) * RotationSpeed;
transform.Rotate (0, rotUpDown, 0) ;
//movement
float ForwardSpeed = Input.GetAxis (“Horizontal”) * MovementSpeed;
float BackwardsSpeed = Input.GetAxis (“Horizontal”) * MovementSpeed * -0.5;
VerticalVelocity += Physics.gravity.y * Time.deltaTime;
Vector3 speed = new Vector3 (MovementSpeed, VerticalVelocity, 0)
CharacterController.Move (speed * Time.deltaTime);
}
}