- Home /
Ok, new respawn and checkpoint system script issues
I have been checking out some of the scripts on the forum and found a script that I understand somewhat and want to use. So, I've tried to make it work for my final project which is a simple platform game. The object is to climb a tower by jumping from block to block, if you miss and fall to the floor you respawn back at the beginning (the floor is tagged "DEATHZONE". I've made spheres and tagged them as "respawn1" and "respawn2" so that the player can respawn back to the checkpoint instead of the beginning to make the game more fun and beatable.
Here is the script for level one, it only has one checkpoint because it is shorter.
private var originalSpawn : boolean = true; //private var respawn2 : boolean; private var respawn1 : boolean;
private var dead = false; var ex = 0; var why = 95; var zee = 0;
//function OnTriggerEnter(other : Collider) //{
function OnControllerColliderHit(hit : ControllerColliderHit) { if(hit.gameObject.tag == "DEATHZONE") { dead = true; } }
//You'll have to make a death script and make a boolean true false command. if (dead == true) { if (originalSpawn == true) { //Put your coordinates of the original spawn point. transform.position = Vector3(0, 95, 0); dead = false; } }
if(other.gameObject.tag == "this") //"other" is giving my an error. I think everything is ok in this script but I don't know. { originalSpawn = false; respawn1 = true; //respawn2 = false; }
if (respawn1 == true) { if (dead == true) { //Put your coordinates of the spawn point. transform.position = Vector3(1.522821, 35.63204, -18.85758); dead = false; } }
//if (other.gameObject.tag == "Checkpoint2") //{ // originalSpawn = false; // respawn2 = true; // respawn1 = false; //}
//if (respawn2 == true) //{ //if (dead == true) //{ //Put your coordinates of the spawn point. // transform.position = Vector3(x, y, z); //dead = false; //} //} //}
Please help me get this working because my final project is due tomorrow and this is the last thing I have to complete...I have some understanding of Java, but try not to blow my mind : )
You should be using the "code" button on your code. It makes it easier to re. Easier to read means people actually look at your code. Better for you.
Your answer
Follow this Question
Related Questions
[2D] [C#] Player dying at respawn at checkpoint 1 Answer
Checkpoint system??? 3 Answers
Checkpoint with PlayerPrefs 0 Answers
Checkpoint script problem 1 Answer
how to disable animator after load in from checkpoint 0 Answers