I’m generating tiles for my 3 Lane endless runner and I was looking for some input/options when it comes to spawn mechanics.
The below code is a snippet of the kind of system I’m implementing but I’m wondering how to implement my spawn logic. For example, my spawnable object prefabs will be various things such as obstacles, enemies, power-ups, currency etc. I wouldn’t want a power-up to appear too often so was thinking maybe have a timer on each object for how often it can spawn. That’s simple enough, and I could do something similar with all my spawnables.
My main worry is creating situations where it is impossible for the user to navigate a path through the obstacles/enemies that are generated and I’m unsure how to manage my logic to avoid this kind of thing. Obstacles can cover single or multiple lanes, and require the user to jump, slide, or strafe left/right to avoid them. Can anyone offer some insight? I haven’t gotten too far ahead with my spawning system so thought it was best to get some advice sooner rather than later.
public class TileObject : ScriptableObject
{
public GameObject prefab;
public int weight;
public List<Spawner> spawners;
public bool spawnersActive;
}
public class TileGenerator : Monobehaviour
{
public List<TileObject> tiles;
}
public class SpawnableObject : ScriptableObject
{
public GameObject prefab;
public int weight;
}
public class Spawner
{
public List<SpawnableObject> spawnables;
public void Spawn()
{
}
}