Creating a Boss Enemy Part 1!
Objective: Create a basic representation for your Boss enemy and give it an attack.
Almost every game has a Boss battle. A boss is a special enemy that is stronger than all other enemy types. Sighting a boss typically signifies either the end of a level or the end of the game.
To create a boss, we are going to start with creating a cube. Also create a C# script and attach it to the cube.
Opening the script, we can get started. We want to have the enemy to spawn off screen then slowly creep in from the top of the screen then stop and hold its position.
We use a bool to signify when the boss has reached its destination.
Next, we need to create a shooting method. We want the boss to shot lasers at the player’s position keeping constant pressure on the player. Using a similar method as before with can fire, and fire rate. To fire at the players position we are going to use a vector 3 direction formula. Then we are going to create a local variable for the rotation. Rotation is going to be equal to Mathf.Atan2 multiplied by Mathf.Rad2Deg.
I wanted to give the feel of having a person pulling the trigger to I set the fire rate to a random integer that was close so it would be slightly different each shot instead of a robotic consistency.
This is just the beginning. In the next part we are going to set a sprite and add collision and health to the Boss. This is the beginning of the end of the game. As I always say, don’t be afraid to experiment with your code, and I’ll see you in the next tutorial!