Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, I am making a maze game and I keep getting this error: Error CS1525 Unexp

ID: 3734919 • Letter: H

Question

Hello, I am making a maze game and I keep getting this error: Error CS1525 Unexpected symbol "&"

Please help me figure out what im doing wrong?

Menlo;"&qt.usang.; UnityEngine; &ltiSpan;); float moveVertical Input.GetAxis ("yertical"); Vector3 movementnew Vector3 (moveHorizontal, 0.0f, moveVertical); rb.AddForse (movement speed) // when the ball collides with a wall void OnTriggerEnter (Collider other) if (other·gameObject.CompareTag (&quotiwal1;")) transform.position - startPos; rbiARKinematAG = false; </span>

Explanation / Answer

<span>
using UnityEngine;
using System.Collections;
public class PlayerMover : MonoBehaviour{
    //to be defined in tha inspector
    public float speed;
    private Rigidbody rb;
    //the spehere's position at the beginning of the game
    private Vector3 startPos;
    void Start()
    {
        rb = GetComponent<RigidBody>();
        startPos = transform.position;
    }
    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement*speed);
    }

    //whan the ball collides with a wall
    void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.CompareTag("Wall"))
        {
            transform.position = startPos;
            rb.isKinematic = true;
            rb.isKinematic = false;
        }
    }
}
</span>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote