Exemple #1
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "Player")
        {
            if (character.transform.position.x < 254)
            {
                coll.gameObject.transform.position = originalPosition;
            }
            if (character.transform.position.x > 254)
            {
                coll.gameObject.transform.position = checkPoint;
            }

            if (character.lives <= 0)
            {
                Application.LoadLevel("Game Over");
            }
            else
            {
                character.DecLives();
                character.death.Play();
            }
        }
    }