Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

make enemy cars spawn faster over time!

$
0
0
hi i got this script that spawns 5 cars every 0.8 seconds but i want them to spawn faster and faster after time so maybe after every 20 seconds the the 5 cars spawn every 0.7 seconds and i want it to stop to accelerate when it is 0.4 please help me i am having big trouble with this, here is my script: public GameObject[] Cars; int carNo; public float delayTimer = 1f; float Timer; void Start () { Timer = delayTimer; } void Update () { Timer -= Time.deltaTime; if (Timer <= 0) { Vector3 carPos = new Vector3(Random.Range(-2.2f, 2.2f), transform.position.y, transform.position.z); carNo = Random.Range(0,5); Instantiate(Cars[carNo], carPos, transform.rotation); Timer = delayTimer; } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles