- Home /
Making a continuous runner... HELP!?
Hey
Iam making a running game. But how do i get the "track" to be continuous and spawn random objects?
Answer by ronaldosilva · Mar 08, 2012 at 07:17 PM
Hi. First, you have to create modules for the track (parts of the level). Lets say, 5 ou 6 modules for instance. For each module, the start and end section can be combined because they fit exactly. Second, in each module you have to place empty game objects that will serve as places to spawn the random objects. Third, you have to create a loop that will create this modules, and place them in the correct order, like this. + + + + .... to infinity.. Remember, each module is a part of the level, and they can be put together side by side seamlessly. The big challenge here is to you manage wich module are visible on the screen and when to remove them when they are off the visible area. If you solve that, the rest is easy. Just create a new Script that will take the empty game objects and replace them for a random asset you created. And finaly, you can take all these modules and parent them to a empty game object, lets say: MainContainerObject. An in this script you make its translate to be continuous.
Overall your problem invokes many solutions to specific small problems, but in general the main logic would be something like what I said.
Answer by rutter · Mar 08, 2012 at 06:40 PM
You could look into some lightweight sort of procedural map generation (that's quite a large topic, in itself). More than likely, you'll want to read the Unity manual page on instantiating prefabs.
This is potentially a very large question you're asking. You'll probably find more help if you can be more specific.