Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void OnCollisionEnter2D(Collision2D collision)
- {
- if (collision.gameObject.tag == "Enemy" && attackPos.gameObject.activeSelf == true)
- {
- Debug.Log("This will do " + enemy.name);
- //collision.otherCollider(EnemyScript.GetComponent<Rigidbody2D>());
- if (facingRight == true)
- {
- enemy.GetComponent<Rigidbody2D>().AddForce(transform.up * 500 + transform.right * 500);
- }
- else if (facingRight == false)
- {
- enemy.GetComponent<Rigidbody2D>().AddForce(transform.up * 500 + (transform.right * 500) * -1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment