Boss Arriving Part-3: Health & Final Wave- Game Dev Series 54
Objective: Create health bar of the boss and add boss to final wave.
With special movement and attacking methods, now should be a wonderful chance to defeat our boss.
In this article, we will create the health bar of the boss and send it into our spawning routing.
Health bar
Create a new slider under Canvas and adjust anything you need like what we did in the previous articles.
In the UIManager script, create a public method to update the slider value.
And in our Boss script, set the health limit to 100 with an integer. Then create a LaserHit() method as in Enemy script, we can create a damage calculation in it.
With this LaserHit() method, boss will lost 2 health per damage, which means you need 50 shot to defeat the boss!
Put it in routine
Now we can create the last wave to reveal the boss.
In our SpawnManager script, under the waves end, add some lines to it to start the boss wave.
In our spawning rules, when the wave counts is equal to the number we set for the maximum wave, it will stop spawning. We just need to enable the boss right before the spawning loop is about to finish.
And that is pretty much everything we need to do in SpawnManager. When the waves is over, it will release the boss to finish the job.
Bonus animation
You can also create some animation to it to make it more like alive.
And use the trigger in LaserHit() method to make a transition.
Boss is finally ready. Prepare for a fully challenge till the end to fight the boss!