Question by
Raviraja190 · Oct 21, 2016 at 07:59 AM ·
respawnrespawningrespawner
Respawn doesn't work ?
void OnTriggerEnter2D(Collider2D target){ if(target.tag =="Cloud"|| target.tag =="Deadly") { if(target.transform.position.y == lastcloudPositionY){ Shuffle(clouds); Shuffle(collectables);
Vector3 temp= target.transform.position;
for(int i=0; i<clouds.Length;i++){
if(!clouds[i].activeInHierarchy){
if(controlX == 0){
temp.x = Random.Range(0.0f, maxX);
controlX=1;
} else if (controlX == 1){
temp.x= Random.Range(0.0f,minX);
controlX =2;
}
else if (controlX ==2){
temp.x=Random.Range(1.0f,maxX);
controlX=3;
}
else if (controlX ==3){
temp.x =Random.Range(-1.0f,minX);
controlX=0;
}
temp.y=distanceBetweenClouds;
lastcloudPositionY=temp.y;
clouds[i].transform.position=temp;
clouds[i].SetActive(true);
Comment
Your answer
Follow this Question
Related Questions
Respawing Enemy After GameObject is Destroyed 2 Answers
Ragdoll death respawn help 0 Answers
Player respawn at death position 0 Answers
How to Respawn an gameObject when it touch another gameObject 1 Answer