- Home /
Question by
Seventh Stealth · Sep 10, 2013 at 07:58 PM ·
javascriptinstantiatespawnmovement script
Script needs fixing ?!
if(spawn){
Instantiate(enemy , transform.position , transform.rotation);
limit-=1;
wait();
transform.Translate(Vector3.forward);
}
if(limit == 0){
spawn = false;
}
if(enemiesLeft == 0){
Application.LoadLevel("winScreen");
}
The script needs to wait four seconds spawn a enemy wait for 4 seconds move it forward and then spawn an enemy again but instead it spawns them all at the same time and they fly off everywhere
Comment
Answer by Wobak · Sep 10, 2013 at 08:02 PM
Are you using WaitForSeconds() in the wait() method? If so, maybe you have to put the yield statement directly within the if(spawn) statement.
Your answer
Follow this Question
Related Questions
instantiate a set amount 3 Answers
Assign the Instantiated Object to an Empty Object. 1 Answer
Issue With Spawning Enemies (javascript) 2 Answers