Boss Arriving Part-2: Attack Methods- Game Dev Series 53

Objective: Create attacking methods of boss.

It is the second part of this boss creating series. Yesterday we have created the movement, now we will create some special attacking methods to our boss.

As my design, boss will have 2 attacking methods:

  • Create tons of laser and spread toward player
  • Summon some normal enemies as support attack

Laser Storm

To create a laser storm, first we need to create an empty. Drag and adjust the position of lasers.

Here I created a new script for laser storm, since it has the only target that is the player, we will not need any other function that might destroy the enemies which we would spawn them in scene later.

I copied all the contents of Laser script and just keep everything I need from it. Make sure your laser would only go down and won’t destroy the enemies, then drag it into Project as a prefab, we can create some lines to call this attack.

In the Boss script, create 2 bool variables as switch.

Then we set 2 method to call these bools to “true”, and call these methods from Start() by using Invoke.

Once we got the switch to turn on our attack methods, we can call them from Update().

In this if statement, I use the same way as yesterday to pick up one of our 2 attacking methods(which is also from another coroutine). Create an ID and pick it up randomly from 0 & 1 in a coroutine. Once the system has the ID and the paired switch(bool) is on, it will launch the attack.

Drag in the prefab, and the method A is ready.

Summon enemies

To call the enemies, we will need to set the GameObject variable, and drag them in editor.

Create a new coroutine as we called it in “else if” statement.

With this coroutine, we will spawn 5 enemies in 5 seconds. And after the spawning, the loop will break with an invoke ready to turn on the switch again.

That’s all! Now we got 2 type of nasty attack from the 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
S.J. Jason Liu

S.J. Jason Liu

99 Followers

A passionate gamer whose goal is to work in video game development.