IEnumerator knockback(Knockback kb) { yield return(new WaitForFixedUpdate()); PlayerMovement pm = GetComponent <PlayerMovement>(); if (pm.grounded || kb.myType != Knockback.KillType.Melee) { if (kb.myType == Knockback.KillType.Melee) { deathSe.sr.sprite = meleeDeathSprite; } else if (kb.myType == Knockback.KillType.Gun) { deathSe.sr.sprite = gunDeathSprite; } else { deathSe.sr.sprite = cannonDeathSprite; } deathSe.transform.position = (Vector2)transform.position + new Vector2(0f, 0.2f); deathSe.show(); StartCoroutine(respawn()); } else { GetComponent <Rigidbody2D>().AddForce(new Vector2(kb.force, kb.force / 2)); } }