Right now when my Character hits my Enemy’s collider he teleports back to a pont in my map but he can get to the point where my enemy has him stuck at his spawn. Is there a way i can make it so that when my enemy triggers the teleport he also teleports back to a spawn of his own.
Here is the Teleport Script:
var target : Transform;
function Update () {
}
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == “teleport”) {
this.transform.position = target.position;
}
}
Is this script attached to the player or the enemy ? And what is tagged "teleport" ? The enemy ?
– KiraSenseiif the enemy is the trigger and the player has the script, why do you check if col.gameObject.tag is equal to teleport ? The tag teleport should be on the target game object right ?
– KiraSensei