void OnCollisionEnter2D(Collision2D coll) { //If frog sees you, create a squash frog above you, and you're no longer allowed to move if (coll.gameObject.name == "Billie") { m_Animator.SetBool("youDead", true); alertsound.playSound(); GameObject go = Instantiate(SquashFrog); go.transform.position = billie.transform.position; go.transform.Translate(Vector3.up * 25.0f); billie.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; affectSlider.youDead = true; affectSlider.awarenesssound.stopSound(); //billiejump.showgameover (); } if (coll.gameObject.tag == "canmovepulley") { if (playSoundOnce) { frogdeath.playSound(); playSoundOnce = false; } } }
private void KillsYou() { //Create a new guard frog above Billie if (!youDead) { m_Animator.SetBool("youDead", true); //Play trumpet sound alertsound.playSound(); //Create the Squash frog above Billie's head GameObject go = Instantiate(SquashFrog); go.transform.position = billieForPosition.transform.position; go.transform.Translate(Vector3.up * 25.0f); //After the Squash frog is created, don't let billie move anymore. billieForPosition.GetComponent <Rigidbody2D>().constraints = RigidbodyConstraints2D.FreezeAll; //billie.showgameover(); youDead = true; } }