- Home /
Question by
dinodaneo12 · Jun 16, 2013 at 06:20 PM ·
replay
Try Again Button
HI im trying to make a ski game and i have a timer and when it runs out i have screen Say replay.I did a Application.LoadLevel(1); it works fine but it doesnt load any of the random gems i have. Please it would be VERY helpful THX!!
Heres My Script
var options=false;
var back=false;
var play=false;
var Count : TextMesh;
function OnMouseEnter(){
renderer.material.color=Color.cyan;
}
function OnMouseExit(){
renderer.material.color=Color.white;
}
function OnMouseUp(){
if (isquit==true){
Application.Quit();
}
if(back==true){
Application.LoadLevel(0);
}
if(options==true){
Application.LoadLevel(3);
}
if(replay==true){
Application.LoadLevel(1);
}
if(play==true){
Application.LoadLevel(1);
}
}
function Awake(){
Count.text = "Score:" + PlayerPrefs.GetInt("dScore");
}
thats my menu script hers my Random spawn Script
var MinTime = .1;
var MaxTime = .8;
var MinX = 0;
var MaxX = 39;
var MinY = 0;
var MaxY = 14;
var MinZ = 0;
var MaxZ = 0;
function LateUpdate () {
transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);
}
function Start ()
{
while (true) {
if (TOT < MaxObjects) {
yield WaitForSeconds(Random.Range(MinTime, MaxTime));
var randomPos = Vector3 (Random.Range(MinX, MaxX), Random.Range(MinY, MaxY),Random.Range(MinZ, MaxZ) );
Instantiate(object, randomPos, Quaternion.identity);
TOT++;
}
yield;
}
}
Comment
Your answer
Follow this Question
Related Questions
Timescale issues 0 Answers
Unity 3 animation replay? 2 Answers
Lerping saved position in FixedUpdate causes inconsistent in speed with the reply ! 0 Answers