Answer the question
In order to leave comments, you need to log in
How to randomize levels for vertical runner?
There is a code but it doesn't work for some reason???
There are walls they move to the bottom, and I need so that the prepared levels that I have in prefabs are compared when other walls go down, then the walls go down and spawn new ones but ready with different obstacles
1 Script Responsible for Wall Movement:
{
public float speed ;
private void Update()
{
Tranform.Translate(Vector2. down * speed * Time. deltatime);
speed += spawner. speed Increase * Time.deltaTime
if (transform.position.y < 0 && !spawned
}
2 Wall Spawn Script
public GameObject[] wall;
public float speed;
public speedIncrease
private void Update()
{
speed += speedIncrease *Time.deltaTime;
}
public void SpawnWave()
{
int rand = Random.Range(0, wall.Lenght);
Instantiate(wall[rand], transform.position, Quaternion.identity);
}
Answer the question
In order to leave comments, you need to log in
private void Update()
{
speed += speedIncrease *Time.deltaTime;
}
public void SpawnWave()
{
int rand = Random.Range(0, wall.Lenght);
Vector3 random_value = new Vector3(Random.Range(0, 0,1f),0,0);
Instantiate(wall[rand], transform.position+random_value, Quaternion.identity);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question