void Start() { restart = false; restartText.text = ""; gameOverText.text = ""; pc1 = player.GetComponent <PlayerControls1>(); SpawnWaves(); //check not to spawn at same spot as player //spawn multiple times }
void OnTriggerEnter2D(Collider2D other) { //if the collision is with player if (other.gameObject.CompareTag("Player")) { //damage player PlayerControls1 player = other.gameObject.GetComponent <PlayerControls1>(); //make player's texture flash red player.startFlash(); //damage player player.takeDamage(10); //destroy bullet Destroy(gameObject); } if (other.gameObject.CompareTag("Wall")) { Destroy(gameObject); } }