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; <iSpan;); 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 ("iwal1;")) 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>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.