Question by
$$anonymous$$ · Oct 12, 2016 at 12:03 AM ·
cs8025cs1525cs1547
Can anyone help me find the problems in this code?
I was following a simple game tutorial and struck quite alot of problems. I was hoping someone would help. I put comments where it says the problem is but idk what to even do there. I got an error cs1547 (41,27) cs 1525(41,28) cs0116(41,28) and last a error cs8025 (56,1)
public class playerMovement : MonoBehaviour { public float moveSpeed; private float maxSpeed = 5f; private Vector3 input; private Vector3 spawn; public GameObject PlayerDeathParticles;
// Use this for initialization
void Start () {
spawn = transform.position;
}
// Update is called once per frame
void Update () {
input = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxis ("Vertical"));//movement controls
if (GetComponent<Rigidbody> ().velocity.magnitude < maxSpeed) {
GetComponent<Rigidbody> ().AddForce (input * moveSpeed);
}
if (transform.position.y < -2 )
{
Die ();
}
}
void OnCollisionEnter (Collision other)
{
if (other.transform.tag == "Enemy") {
{
Die ();
}
}
void OnTriggerEnter(Collision other)//this has a red line under it
{
if (other.transform.tag == "Goal")
{
GameManager.CompleteLevel ();
}
}
void Die ()// this has a red line under it
{
Instantiate (PlayerDeathParticles, transform.position, Quaternion.Euler(270.0.0));
transform.position = spawn;
}
Comment
Answer by doublemax · Oct 12, 2016 at 06:45 AM
if (other.transform.tag == "Enemy") {
{
Die ();
}
Here is one "{" too many.