Boss Arriving Part-1: Movement- Game Dev Series 52

Objective: Create a boss with unique movements.

It is about time to face the final threat. Boss is coming.

This article we be the first part of our boss creating series. In this we will focus on creating the unique movements of the final boss.

For what I design of the boss, it will have 2 movements:

  • Side moving left and right
  • Moving on several specific spots continually.

Side movement

The boss would going from the top till reach the setting height to start this unique movement.

We need to create a new script then create some variables to it.

To move left and right, we will need to change the value on x-axis. Adjust this value in a coroutine to keep changing the value constantly.

We can call the movement method in Update() to move. And also, add an if statement to move straight down first, then start movement A.

Moving on specific spots

Next we will make the boss walks on the lines that we create.
First we need to create some empty gameobjects to locate the position.

Then in our script, we will use the array to locate the next moving target. When the boss is near one of the target, the target will change to the next one.

In this method, first we calculate the target with the result “p”. Then we use it as the number of the array gameobjects, which the boss will identify it as next target.

Then we can call this method in Update(). However, since we have 2 movement method, we should make it randomly choose 1 movement method in a period of time.

Calling this coroutine and it will(or not) gives a way to move every 10 seconds.
Now we just need to add a switch statement to choose our movement.

Face the player

With these movements, now we need to make the boss always faces the player. This is quite similar to what we setting to our missile.

As what we did before, first we calculate the direction to the player, then calculate the angle with Atan2.
Adding the turning offset, then use it as rotation to the boss.
Then add these lines in Update(), too.

All done! With these movements, next we will create the attacking methods.

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