This article will show how to make a new Enemy type that lays mines as it moves down the screen. We will also make the functionality of the Mine.
The new Enemy type is straightforward to implement. We need to override the FireLaser method and instantiate the Mine Prefab instead of the Laser Prefab.
This article will show how to make an Enemy that will dodge the Player’s Laser shots if they may have a chance to hit the Enemy.
This dodging Enemy class will inherit from the Enemy Abstract Class. To control the dodging, we need some variables. The first is a float for the speed the Enemy will move at when dodging. Next are two bools, one so we know if the Enemy should be avoiding, and the other to know the direction the Enemy should escape. …
This article will show how to create an aggressive Enemy that will attempt to ram the Player when in range. Also, the Enemy will make sure the Player is in front of them to avoid moving backward and have a recovery period if not destroyed when colliding with the Player.
The AggressiveEnemy script will inherit from the Abstract Class Enemy. Now we need some variables. First are four floats, one for the range to check if the Enemy should ram, second for the speed to move at while ramming, third for the length of the recovery period, and the last…
This article will make an Enemy that moves side to side as it goes down the screen, creating a zigzag motion. This script will inherit from the Abstract Class that we converted the Enemy script to in the previous article.
For the ZigZag Enemy type, we need to change two things in the Enemy script. The first is to change the _isDead bool accessibility to protected.
The second is to create a new protected virtual method that will contain the code from CalulateMovement that runs when the Enemy re-spawns because it has hit the _verticalLimits. …
This article will make an Enemy that fires from the rear when it has passed the Player on the screen. This script will inherit from the Abstract Class that we converted the Enemy script to in the previous article.
The first thing we need to do is give the new Enemy Prefab a second point to spawn the rear Laser.
In the RearFireEnemy script, we need two variables. The first is for the Transform that the rear Laser will spawn. …
In this article, we will convert the Enemy script to an Abstract Class. Changing it in this way will allow us to create more Enemy Types easily without rewriting a large amount of code to make them behave like the standard Enemy but with changes.
To change the Enemy script to an Abstract Class, we need to add the abstract keyword when declaring the class.
Since there will be other scripts inheriting from this script, we can use the protected accessibility on the variables that we want the inheriting scripts to access.
This article will show how to make all Power-Ups within range move towards the Player while the ‘C’ key is pressed.
In the PowerUp script, we need to add two variables. The first is a Transform that is used to locate the Player, and the other is a bool to know if the Power-Up should move to the Player.
This article will show how to make a Power-Up that will negatively affect the Player if it is collected. The negative effects will be the loss of one health and an increased fire delay for the Power-Up duration.
In the Player script, we need a few variables. The first is a float for the amount to increase the fire delay. The second is another float, so we know how long the negative effect should last, and the final variable is a bool, so we know when the negative effect is active.
This article will show how to give the Enemy a random chance for an active Shield. Implementing this is similar to the Player Shield, covered in two previous articles, one with the base Shield and the other allowing the Shield to take multiple hits.
Add the Shield Visual from the Player to the Enemy Prefab.
In the Enemy script, we will need all of the Shield variables from the Player script. Which are int for the maximum Shield strength, an int for the current Shield strength, a GameObject for the Shield Visual, a bool to know if the Shield is…
This article will show how to create an omnidirectional shot to kill enemies all around the Player. Since a lot of this is very similar to implementing the Triple Shot Power-Up from a previous article, I will gloss over the identical parts.
In the Player script, add three variables, a GameObject for the Prefab, a bool to know if to use the Omni-Shot, and a float for the duration of the Omni-Shot.
In Start, set the Omni-Shot duration to the Power-Up duration.
Unity Developer, Software Engineer, Game Designer