Commit 18662f9a by Philipp Adolf

Make bullets stop on walls

parent ab195c8a
...@@ -20,7 +20,11 @@ public class Bullet : MonoBehaviour ...@@ -20,7 +20,11 @@ public class Bullet : MonoBehaviour
void OnTriggerEnter2D(Collider2D other) void OnTriggerEnter2D(Collider2D other)
{ {
if (healingPoints > 0 && other.tag == "Player") if (other.tag == "Obstacle")
{
Destroy(gameObject);
}
else if (healingPoints > 0 && other.tag == "Player")
{ {
other.GetComponent<PlayerHealth>().changeHealthBy(healingPoints); other.GetComponent<PlayerHealth>().changeHealthBy(healingPoints);
Destroy(gameObject); Destroy(gameObject);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment