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

How do I only clone 1 enemy instead of infinity enemies??

$
0
0
I made a script, and when the timer reaches 0 I want it to only spawn 1 enemy but it keeps spawning. What do I add to the script pls help. var timer : float = 10.0; var enemy : Rigidbody; var sound : AudioClip; function Update () { timer -= Time.deltaTime; if(timer <= 0) { var clone : Rigidbody; clone = Instantiate(enemy, transform.position, transform.rotation); clone.velocity = transform.TransformDirection (Vector3.forward); AudioSource.PlayClipAtPoint(sound, transform.position, 1); } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles