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

Get attacked by enemies when they spawn

$
0
0
hello! so i have this script to make the enemies spawn with a delay.. and what i need is that every time an enemy spawns, it attacks the player with a projectile. public class TimedSpawn : MonoBehaviour { public GameObject spawnee; public bool stopSpawning; public float spawnTime; public float spawnDelay; // Use this for initialization void Start () { InvokeRepeating ("SpawnObject", spawnTime, spawnDelay); } public void SpawnObject (){ Instantiate (spawnee, transform.position, transform.rotation); if (stopSpawning) { CancelInvoke ("SpawnObject"); } } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



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