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

Objective: Create attacking methods of boss.

I updated the sprite!!

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().

Don’t forget to create a serializefiled to call the prefab we just created.

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!

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Kind building good.

GridGain with Active Directory: Multiple Groups for a Single User

How to Enable In-Game Voice Chat on a Cloud Server

Redis Cluster in Docker

CS3710 Blog #5, Fall 2020

Turn your organisation’s data exhausts into fuel

How I’m managing a CS Masters while working full time (Part 1)

Contact to Other Scripts with GetComponent- Game Dev Series 10

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

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

More from Medium

Unity : AI && NavMesh [FSM : (Finite State Machine with Enum)]

Day 105: Working with Animation Events in Unity

Adding a burst laser powerup

Using GameDevHQ’s FileBase Asset Database For HQ Models