It’s been a little while since I wrote a blog on my coding endeavor, so I will be continuing from where I had last left off in my previous writing.
So last I wrote I had finally functionally added the shield lives to the UI to be displayed and correctly removed as the lives of the shield went down.
This time I decided to go a step further and also add in a visual change to the shield color to be in tandem with the shield’s lives displayed.
The shield color I got to change with the lives left is obvious, but the enemy that kept firing even after it had died, due to allowing the animation to run 2.5 seconds before actually destroying the enemy object, is not so obvious. But I assure you it was a pain figuring how to make the EnemyFireLaser function stop without making a coroutine.
What I ended up doing, though it probably is not optimal, was making a controlEnemyFire bool.
This way when the enemy is on its way out to be destroyed the bool would ensure that the enemy fire would do nothing when it is being recognized as “true”. I’m still learning, but this was the best I could figure out.
After the shield lives visualizations and adding the image to the UI, I was supposed to work on an ammo count, but that enemy firing bug was irking me for a while. Now that is FINALLY taken care of, next I will work on the ammo count for the Player spaceship.