void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.name.Substring(0, 5) == "Enemy" && !isInvincible) { // Replace this with whatever should happen when the player gets hit by an enemy! if (!spawning.playerHit()) { GetComponent <Animator>().SetTrigger("jaxDeath"); SceneManager.LoadScene("Game Over"); } GetComponent <Animator>().SetTrigger("jaxHit"); isInvincible = true; hurtSFX.Play(); } }