hey guys im makeing a game and how do i do this the playe r the spher needs to go through this little circles to complte the level like pacman but he/she neds to get all the circles before he goe’s to the next level so thanks for reading.
1 Answer
1var sphereCount : int = 100; //how many spheres the guy needs to gobble up
private var remainingSpheres : int;
function Start(){
remainingSpheres = sphereCount;
}
function OnTriggerEnter(col : Collider){
if(col.gameObject.CompareTag("Sphere")) {
Destroy(col.gameObject);
remainingSpheres--;
if(remainingSpheres <= 0) Application.LoadLevel(Application.loadedLevel + 1);
}
}
If this answers your question, mark it as answered.
– flaminghairball