Boss AI

● 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

First thing is to create a empty GameObject for the boss and add a visual to represent it in game.

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 created an Animation for the Boss to move on to the screen. I also turned of the weapons and the wings. Once the Boss is on screen I turn all of the weapons and wings on.

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 start off by making a new Laser Prefab for the Boss to use as its Big laser

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 am going to change the Main Weapon to fire a solid laser beam that moves with the Boss.

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



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
James Lafritz

James Lafritz


Excited about changing my hobby into a new carer with GameDevHQ course.