Hi im trying to stop my launch from firing but the code im using dosen,t work any help

using UnityEngine;
using System.Collections;

public class BatteryHealth : MonoBehaviour {
public float batteryFull = 70.0f;
float batteryRemaining;
int percentRemaining;
bool trackingBattery = true;
GUIText guiTxt;

// Use this for initialization
void Start () {
batteryRemaining = batteryFull;
guiTxt = GetComponent ();
guiTxt.text = “100%”;

}

// Update is called once per frame
void Update () {
if (trackingBattery) {
if (batteryRemaining > 0) {
batteryRemaining -= Time.deltaTime;
percentRemaining = (int)((batteryRemaining / batteryFull) * 100);
guiTxt.text = percentRemaining.ToString () + “%”;
}
else{
GameOver();
trackingBattery = false;
}
}
}
void GameOver(){
GameObject.Find(“Fire Point”).SetActive (false);

}
}

When you put code in the forum, use the INSERT icon then click “Code” so that people can more easily follow your script. That way, people will find it easier to help you.

Hi I’m not real good at this yet! . but how do I do insert? and thank you for your advise

using UnityEngine;
using System.Collections;

public class BatteryHealth : MonoBehaviour {
public float batteryFull = 70.0f;
float batteryRemaining;
int percentRemaining;
bool trackingBattery = true;
GUIText guiTxt;

// Use this for initialization
void Start () {
  batteryRemaining = batteryFull;
  guiTxt = GetComponent<GUIText> ();
  guiTxt.text = "100%";

}

// Update is called once per frame
void Update () {
  if (trackingBattery) {
    if (batteryRemaining > 0) {
      batteryRemaining -= Time.deltaTime;
      percentRemaining = (int)((batteryRemaining / batteryFull) * 100);
      guiTxt.text = percentRemaining.ToString () + "%";
    }
    else{
      GameOver();
      trackingBattery = false;
    }
  }
}
void GameOver(){
  GameObject.Find("Fire Point").SetActive (false);
}
}

Fixed.

I’m not really sure what the issue you’re having is. What launch? What do you mean by ‘firing’?

void GameOver(){


34.  GameObject.Find("Fire Point").SetActive (false);


35.}

///
In this part of the code is the only part that dose not work!
I’m using a GUI Text Called batteryLIfe to count down and when it hits 0 should call for the Fire Point to stop shooting
on my potato launcher. I’m working from a book called Unity for Absolute Beginners . But thanks for the advice on “insert”

Throw in some Debug.Logs. Is GameOver being called?