private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.tag == "Enemy" && !invulnerable && !pinwheeling) { //Debug.Log("Player taking Damage"); TakeDamage(); invulnerable = true; /*Vector3 dir = new Vector3(collision.contacts[0].point.x, * collision.contacts[0].point.x, * transform.position.z) - transform.position; * dir = -dir.normalized; * * * if (isFacingRight) rb.AddForce(dir * 3); * else rb.AddForce(dir * -3);*/ if (isFacingRight) { rb.AddForce(8 * Vector3.left); } else { rb.AddForce(8 * Vector3.right); } isHit = true; } if (collision.gameObject.tag == "Bound") { //Debug.Log("Player touched bounds"); LevelEndScript.animateFall(); transform.position = respawnPosition; TakeDamage(); invisTimer = 20; GetComponent <SpriteRenderer>().enabled = false; } if (collision.gameObject.tag == "Level Map") { isGrounded = true; } }