Boss AI

Objective:
● Create a final wave that includes a boss at the end.
● Moves down the screen to the center and stays there.
● Unique attacks towards the player

Creating the Boss

I added some weapons with a circle to represent them visually and a circle collider. I also added a capsule to represent the wings with a capsule collider.

I ended up moving Sprite to the Boss and deleted the Child Sprite Game Object. I added Destroy No Children to the Boss.

I then added the Damageable Component to the Weapons and Wings. Made them all have a shield that takes one hit and they all have 1 life.

Boss Movement

I then created an animation to make the Boss move back and fourth on the screen.

Now there is a problem when running the game. When the game starts the Boss has it’s Weapons active so the Start method runs and the cool down timers start, the Animator then disabled the Weapons which stops all the Corutines. The Animator then enables all of the Weapons but the timers never start counting down again.

To fix this I need to use the OnEnable and OnDisable methods on the weapon scripts.In the OnDisabled method I will make sure that the timer is no longer active and in the OnEnable I will start the timer.

While I was at it I went ahead and applied this fix to all the Behaviors that used the cool down timer, I only used the OnEnabled method if I was starting the timer in the Start method.

Creating Unique attacks

I Use this new laser prefab on the Weapon. I also changed the Min cool down time to 0.1 and the Max cool down to 1.

For the Left and Right Wing I changed the Weapon to an Enemy Smart Weapon. I use the Homing laser as the secondary laser.

The new Big Bad Boss

Adding a Unique Attack

I need a Behavior that will make the laser move with the Boss.

Every Time that I instantiate a laser I need to set the target to move with.

The Weapon Behavior
The Enemy Smart Weapon

I need to add detection in the Damageable Behavior for staying in the trigger.

I also need a Behavior that will destroy the Laser after a set time.

Now all I have to do is make use of these on the Big Boss Laser and the Boss Weapon.

The Completed Boss