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

Enemy Spawner

$
0
0
Im working on a game and i just cant figure out how to fix my enemy spawner. Im aiming for a certain behavior which is spawning easy enemies x20( or any no.) then medium enemies and after that a endless spawn of random easy, medium and hard enemies . I also want between each spawn to have like a delay or break for 1-2 seconds so it doesn't looks like the enemies are spamming on top of each other Currently i'm having only easy and medium enemies to spawn and its ending its not endless besides im getting an array out of range error Your help is appreciated and thank you in advance This is my Code: using UnityEngine; using System.Collections.Generic; using UnityEngine.UI; public class Test : MonoBehaviour { public GameObject[] enemy; public Transform[] spawnPoints; private float timer = 2; int index = 0 ; int wave = 0; List EnemiesList = new List(); private int enemyCount=20; void Update() { timer -= Time.deltaTime; if (timer <= 0 && wave < 6) { timer = 3; if (wave != 0 && wave % 2 == 0) { index ++ ; } EnemySpawner(); wave++; } } void Spawn () { for (int i = 0; i

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>