Added all four gun types and firing bullets stable (although there is some slight 'recoil' for some variations)

This commit is contained in:
Gregory Campbell
2020-07-11 13:26:02 -04:00
parent 3da029586a
commit 3295e58965
6 changed files with 92 additions and 15 deletions
+2 -8
View File
@@ -24,20 +24,14 @@ public class BulletScript : MonoBehaviour
void OnCollisionEnter2D(Collision2D other)
{
if(other.gameObject.tag != "Player")
if(other.gameObject.tag != "Player" && other.gameObject.tag != "Bullet")
{
Destroy(gameObject);
}
if(other.gameObject.tag == "Player")
{
Physics2D.IgnoreCollision(
other.gameObject.GetComponent<Collider2D>(), GetComponent<Collider2D>());
}
}
void OnBecameInvisible()
void OnBecameInvisible()
{
Destroy(gameObject);
}