Day16, Enemy Shield + Randomized Spawn

Ji Soo Ahn
Dec 8, 2020

Hitting through the last few left of the curriculum, today’s implementation consisted of an enemy shield which pretty much gives each enemy one extra health. Sprites can be drawn same to the player’s shield and give the same property.

Challenges were faced when I had implemented the shielding through
_enemyPrefab.GetComponent<Enemy>().EnemyShield();
all the spawned enemies then after came with shields automatically. I needed to write an else statement that brought in the NoEnemyShield properties.

I started off with the isEnemyShieldActive() script on the top, but it seems like it was conflicting with evade script that was letting the enemy to move aside from incoming laser. However, when the script was moved to the bottom, the conflict has disappeared. I’m not sure why the problem arose, but hey it’s a fix!

--

--