Respawn Menu Script

Updated on July 23, 2018 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
3 on July 24, 2014

So wrote the script just as tutorial said, but when i start the game it just appears and i cant move, without me dying, also it shows that i have 100 HP, how to fix this?

  • Liked by
Reply
0 on July 25, 2014

Can you post your code here please

  • Liked by
Reply
Cancel
0 on July 25, 2014

This is for Respawn menu

#pragma strict
var LookAround01 : MouseLook;
var LookAround02 : MouseLook;
var charMotor : CharacterMotor;
var sprintScript : SprintAndCrouch;
static var playerIsDead = false;
function Start () 
{
 LookAround01 = gameObject.GetComponent(MouseLook);
 LookAround02 = GameObject.Find("MainCamera").GetComponent(MouseLook);
 charMotor = gameObject.GetComponent(CharacterMotor);
 sprintScript = gameObject.GetComponent(SprintAndCrouch);
}
function Update () 
{
 if(playerIsDead == true);
 {
 LookAround01.enabled = false;
 LookAround02.enabled = false;
 sprintScript.enabled = false;
 charMotor.enabled = false;
 }
}
function OnGUI ()
{
 if (playerIsDead == true);
 {
 if(GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40), "Respawn"))
 {
 RespawnPlayer ();
 }
 if(GUI.Button(Rect(Screen.width*0.5-50, 240, 100, 40), "Menu"))
 {
 Debug.Log ("Return to Menu");
 }
 }
}
function RespawnPlayer ()
{
 Debug.Log("Respawn Player");
}

and this is for HP

#pragma strict
var Health = 100;
function ApplyDamage (TheDamage : int)
{
 Health -= TheDamage;
 if(Health <= 0)
 {
 Dead();
 }
}
function Dead()
{
 RespawnMenu.playerIsDead = true;
 Debug.Log("Player Died");
}

  • Liked by
Reply
Cancel