I am trying to find or get help creating a script to reset the level when my Player is “killed” or comes into contact with a certain object
I have little coding knowledge so please if you would be so kind to dumb down your answers
Thank You
Hello
Can you please tell me If you re-load the scene then it will solve your problem or not?
Reload the scene will act like same as you entered the scene. Now you have to do like suppose if your player have health. Now you have to place the check whether/if the player has health 0. Then you will show the game over screen & on “Retry” or “Play Again” button the scene must be reload.
With the line Application.LoadLevel("SceneName");
or Application.LoadLevel(Application.loadedLevel);
Now that was the one answer to your question.
For the Region / specific area when player get in that area. There are different types of option to do this . It is basically depend upon the scene. But the most common one is to place the empty triggered collider which will tell you when the player enter in the region.
For that you have to write like :-
void OnTriggerEnter(collider c){
if ( c.transform.tag == "Player"){
// Show game over screen here
}
}
void OnPlayAgainButton(){
Application.LoadLevel(Application.loadedlevel);
}
There is also one more solution of your question is to will track all the things of the objects, references in your game like player score, health , positions of the objects etc etc. and when the player get killed then you have to call the that Reset()
method in which it will reset all the vales.
This method is little hard as compared to the above one.
Note - Rest all the approach vary with your requirement of the games/requirements.