Hello, Im trying to create a random platform generator on which a character is supposed to jump higher and higher up on. but whenever i generate my map some platforms are further away or too close for a possible jump. Im wondering if anybody can help me with this
Here is my code:
public GameObject platform;
// calls on initiation
void Start()
{
RandomMapBuilder();
}
// Random map builder
void RandomMapBuilder()
{
// Spawn spawns for zone 1
for (int i = 0; i < 20; i++)
{
// Creates positions for all the ground/ platforms to spawn
Vector3 SpawnPosition = new Vector3(Random.Range(-10, 10), Random.Range(0, 100), 0);
Instantiate(platform, SpawnPosition, Quaternion.identity);
}
}
↧