Comming Along nicely!

I recently posted a mini-teaser for my game chains. Glad to say that it's really getting closer. I've fixed up the range system (the white circle that you see in the picture). Which was easier than I thought.. Even better, I've managed to create the beginning of random level spawning system. Look below for a code snippet, and if you do, please consider that it's just the beginning of it. It'll get more advanced as I figure out exactly how I want it to work





void SampleGenerate()
 {
  if(lastOrb == null)
  {
   lastOrb = GameObject.Find("OrbFirst");
  }
  pos = lastOrb.transform.position;
  pos.y += Random.Range(0.8f,3.5f);
  if(lastOrb.transform.position.x < -2 && lastOrb.transform.position.x > -4)
  {
   pos.x += Random.Range(-1f,2.1f);
  }
  else if(lastOrb.transform.position.x > 2 && lastOrb.transform.position.x < 4)
  {
   pos.x += Random.Range(-2.1f,1f);
  }
  else 
  {
   pos.x += Random.Range(-2f,2f);
  }

  InstOrb();
 }

 void InstOrb()
 {
  int Select = Random.Range(0,10);

  switch(Select)
  {
  case 0:
   
   lastOrb = Instantiate(orbPrefab,pos,Quaternion.identity) as GameObject;
   break;

  case 1:
   lastOrb = Instantiate(pinkOrbPrefab,pos,Quaternion.identity) as GameObject;
   break;

  case 2:
   lastOrb = Instantiate(blueOrbPrefab,pos,Quaternion.identity) as GameObject;
   break;

  case 3:
   lastOrb = Instantiate(redOrbPrefab,pos,Quaternion.identity) as GameObject;
   break;

  default:
   lastOrb = Instantiate(orbPrefab,pos,Quaternion.identity) as GameObject;
   break;

  }
 }



Categories: