Quantcast
Viewing all articles
Browse latest Browse all 187

count the number on enemyes entrering into a trigger

Im having some confusion here, i have a trigger collider and i want if x number of enemies past trought this collider restart the game, and i try this but nothing hapen #pragma strict var numEnemies : int = 3; function OnTriggerEnter2D(other: Collider2D) { if(other.CompareTag("Enemy")){ for(var i : int = 0; i > numEnemies; i++){ EndOfLevel(); } } } function EndOfLevel(){ yield WaitForSeconds(2); // ... and then reload the level. Application.LoadLevel(Application.loadedLevel); }

Viewing all articles
Browse latest Browse all 187

Trending Articles



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