- Home /
Question by
lionel1234 · Mar 08, 2021 at 12:53 AM ·
2d2d-platformer2d-physics2d-gameplay
Trying to implement a parry mechanic
My combat system uses OverlapCircleAll in order to determine when the player/enemy gets hit but I cant figure out how to check if two circles collider with each other. This is how the code looks like on the player side, the enemy side is the same with different named variables:
void Attack()
{
Collider2D[] hitEnemies = Physics2D.OverlapCircleAll(attackPoint.position, attackRange, enemyLayers);
foreach (Collider2D enemy in hitEnemies)
{
enemy.GetComponent<EnemyController>().Damaged(attackDamageP);
}
}
How would i go about making the player Attack function check if it has collided with another circle?
Comment