i am creating a simple game.There are two gameobjects a “ball1” and a “paddle”. the ball bounces on the paddle. player have to ballance the ball. i created a scene “gameover” and i want that when ball is missing the paddle or y position of ball is less than the y position of paddle than it is the instant of game over. but in coding, i don’t know how to do it.please help me.
i just tried that code but it is not working.please help…
function end () {
if(GameObject(“ball1”).transform.position.y <= GameObject(“paddle”).transform.position.y)
{
Application.LoadLevel(“gameover”);
}
GameObject ball1; GameObject paddle; function Start() { ball1 = GameObject.Find("ball1"); paddle = GameObject.Find("paddle"); } function Update () { if(ball1.transform.position.y <= paddle.transform.position.y) { Application.LoadLevel("gameover"); } Note: First you should take some programming lessons for UnityScript.
GameObject ball1; GameObject paddle; function Start() { ball1 = GameObject.Find("ball1"); paddle = GameObject.Find("paddle"); } function Update () { if(ball1.transform.position.y <= paddle.transform.position.y) { Application.LoadLevel("gameover"); } Note: First you should take some programming lessons for UnityScript.
– HarshadK