// Update is called once per frame void Update() { if (transform.position.x <= -16.0f) { gameOver.SetActive(true); Destroy(this.gameObject); } if (rb.velocity.magnitude > 0.5f) { spr.sprite = jumping; aim.SetActive(false); } else { spr.sprite = still; aim.SetActive(true); if (aimScript.onLilyPad) { transform.parent = aimScript.currPad.transform; } else { GameObject newSplash = Instantiate(splash); newSplash.transform.position = transform.position; HealthScript h = health.GetComponent <HealthScript>(); h.LoseLife(); if (h.GetLives() > 0) { transform.position = new Vector3(transform.parent.position.x, transform.parent.position.y, transform.position.z); transform.GetComponent <AimScript>().onLilyPad = true; } else { Destroy(this.gameObject); gameOver.SetActive(true); } } } }