Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

box Colliders

$
0
0
![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; } } ____________________________________

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>