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

Poseidon Mining Testnet Phase5 is LIVE !

Merging Django Projects (part 1) — Back from the Microservice

How we mitigate risk and improve customer health using Honeycode

Challenge Accepted: How did I win a Windows Surface Go 2

How to use Unity’s new Input System to simplify and expand your game’s controls

Distribute Pods Evenly On Kubernetes Cluster With podAntiAffinity

Trading through code— a limit-sell order partially executed by someone else’s market-buy order

Redis Sorted Sets with Spring Boot and Jedis

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

Creating Elevator in Unity — Part 3: Moving Elevator.

Adding a burst laser powerup

Gamedev Log: “Slash’n’crack” #4 (Unity/C#)

Building A Stealth Game — Helping Your Guards “See”