Me and my partner are trying to make a teleportation script that moves a quad to one of three objects (named: right, left, middle) used as a position. To activate the teleportation function we have assigned the W,A,S,D keys to move the quad when pressed.
Here is a copy of the script:
#pragma strict
GameObject right;
GameObject left;
GameObject middle;
GameObject groundspawn;
void Start()
{
groundspawn = GameObject.FindWithTag("Groundspawn");
right = GameObject.FindWithTag("Right");
left = GameObject.FindWithTag("Left");
middle = GameObject.FindWithTag("Middle");
}
function Update()
{
if (Input.GetKey (KeyCode.D))
{
{
groundspawn.transform.position = right.transform.position;
}
}
if (Input.GetKey (KeyCode.A))
{
{
groundspawn.transform.position = left.transform.position;
}
}
if (Input.GetKey (KeyCode.S))
{
{
groundspawn.transform.position = middle.transform.position;
}
}
if (Input.GetKey (KeyCode.W))
{
{
groundspawn.transform.position = middle.transform.position;
}
}
}
Here are errors we have recieved:
Assets/Scripts/teleportsript.js(3,19): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Scripts/teleportsript.js(4,19): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Scripts/teleportsript.js(5,19): UCE0001: ‘;’ expected. Insert a semicolon at the end.
Assets/Scripts/teleportsript.js(6,19): UCE0001: ‘;’ expected. Insert a semicolon at the end.