![alt text][1]
[1]: /storage/temp/184455-screenshot-2021-08-06-194323.png
Hello, i added two colliders to my 2D player. but when the player touch an enemy it takes 2 hearts from his life. that because the enemy is colliding with two different colliders. how can i solve this problem?
here is the code :
if (gameObject.CompareTag("Enemy") && playerHealth > 0)
{
if (doubleJump > 0 && rb.velocity.y < 0)
{
kills++;
Destroy(gameObject);
return;
}
else
{
playerHealth--;
return;
}
}
____________________________________
↧