Skip to content

Instantly share code, notes, and snippets.

@xSystemIOx
Created May 9, 2018 14:41
Show Gist options
  • Select an option

  • Save xSystemIOx/0ff13d6a6fd4bfcabbb3d6e19a507d54 to your computer and use it in GitHub Desktop.

Select an option

Save xSystemIOx/0ff13d6a6fd4bfcabbb3d6e19a507d54 to your computer and use it in GitHub Desktop.
Spawns objected between two horizontal points
if (startSpawn == true) {
if (Time.time > nextSpawn) {
nextSpawn = Time.time + spawnRate;
randX = Random.Range (-12f, 1f);
randomeObject = Random.Range (0, 8);
Vector3 spawnPoint = new Vector3 (randX, transform.position.y);
Instantiate (Objects [randomeObject], spawnPoint, Quaternion.identity);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment