This commit is contained in:
SpoodyTheOne 2024-02-04 09:12:58 +01:00
parent 3cc55a9b74
commit 54b6c3115c
1 changed files with 11 additions and 0 deletions

View File

@ -80,4 +80,15 @@ public class PlayerMovement : MonoBehaviour
} }
} }
void OnCollisionStay2D(Collision2D collision)
{
Debug.Log("Hit other " + collision.otherCollider.gameObject.name);
Debug.Log("Hit other " + collision.collider.gameObject.name);
if (collision.collider.gameObject.CompareTag("Enemy"))
{ // Other object is an enemy
Debug.Log("Hit enememenemy");
hp.TakeDamage(1f);
}
}
} }