Hello, I’m no programmer and I’ve been having problems with my little noob script. I’ve never done scripting before, so I’m going to embarrass myself here by asking a really noob question. ![]()
I have a simple game where you have to get 5 different colored balls into various holes in the level. There is an invisible plane under the level that has this script attached to it. Basically if the player collides with it, it loads the game over screen. But as the script is now, if ANY one of the balls collide with it, it loads the next level.
I need to make it so it only loads the next level if ALL the balls have collided with it.
Here’s the code:
function OnTriggerEnter(other : Collider) {
if (other.gameObject.name == "First Person Controller")
Application.LoadLevel (1);
if (other.gameObject.name == "Blue Ball");
(other.gameObject.name == "Yellow Ball");
(other.gameObject.name == "Pink Ball");
(other.gameObject.name == "Green Ball");
(other.gameObject.name == "Red Ball");
Application.LoadLevel (2);
}