Search Unity

Endless runner with pre-made rooms that spawn randomly

Discussion in 'Scripting' started by Somaroton, Aug 4, 2015.

  1. Somaroton

    Somaroton

    Joined:
    Aug 4, 2015
    Posts:
    5
    I couldn't come up with nothing better than creating rooms with some number attached to it and a random number generator that will make obj spawners on the right side beyond the screen to create their objects that will move to the left with a certain pattern.

    But I feel like this is going to be frustrating to make. Is there a better way to do this?
     
  2. oOHicksyOo

    oOHicksyOo

    Joined:
    Feb 22, 2015
    Posts:
    17
    You could creat generic rooms(if 3d) with spawn points for other objects. Have a manager script hold all the prefabs which give it that number you want , randomly spawn one setting and unit function in the prefab that will randomly choose if a objects spawn at that spawn point. Less work more random
     
  3. phoda

    phoda

    Joined:
    Nov 11, 2014
    Posts:
    384
    Just make that objects created at right are being destroyed after 2-5 sec? how long they will longest appear on screen.
    as hicksy said. Create one type of terrain, enemy, bonus, whatever and save it as prefab and randomly instantiate when player gets to next set of enemies, obstacles ... as for spawner, you can use empty gameobject with script that checks distance between the gameobject and player (vector3.distance) and when it is close enough spawn set of something and move for (10,20... x so right) and wait again for player.

    all this can be set to spawn according to playtime or level or something