Objective: Create an enemy that fires a laser at player when the enemy gets behind the player.

Some enemies wait until they get behind the player then fire at the player.

Within the Enemy script, create a new enemy type, _enemyID of 4, that will attack the player from behind . Increasing _enemyID = Random.Range(0, 4) to _enemyID = Random.Range(0, 5) in void Start() creates this new enemy type 20% of the time. In void Update() modify the laser fire to allow an aimed shot, as shown below. After instantiating the enemy laser, the laser needs to point at the player. Since this is 2D game, transform.LookAt or Quternion.LookRotation collapse the collider and are…


Objective: Using Unity add a UI element that shows both the current and maximum laser power levels

Current and max ammo is shown for laser power and missiles

Currently the game has two types of ammo lasers and missiles, so create UI text objects named Ammo_text and Missile_text. Anchor them in the upper right corner, as shown above, with font size of 20 and set color to white. Use SerializeField to assign these objects to the variables below.


Objective: Create an enemy that rams the player when it gets within range.

Some enemies now try to ram the Player.

The Enemy script controls enemy behavior. The variables shown below will be used to control the enemy behavior to try to ram the player. The _enemyID is assigned using Random.Range(0, 4) and if it is 3 then will ram the player if in range, _playerDetectRange.


Objective: Add powerup allowing the player to fire two homing missiles that target the nearest enemy.

After collecting powerup, player has missiles that target nearest enemy.

Adding homing missiles is a complex task, requiring a powerup for the player to get the missiles, visual effects for the missiles, code for the player to fire the missile and identify the enemy, and code for the missile move to and destroy the target once fired. The initial step is to create the missile.png file, using PowerPoint®. Drag this file into the Unity asset folder and the Texture Type set to Sprite (2D & UI).


Objective: Give some enemies a shield which blocks one hit.

Some enemies now have shields.

Take the Enemy prefab and drag it into the scene, and set position to (X 0, Y 0, Z 0). Copy the Player’s Shield and paste as child of the Enemy. Change shield position to (X 0, Y 0, Z 0) and set the shield’s scale to 1.0 for X, Y, Z. Make sure the shield is inactive. Apply overrides to the Enemy prefab.


Objective: Provide new enemy movement based upon enemy type.

Enemies now have more diverse movement.

Enemies always moving down at the same speed is not realistic, so to add enemies with more variable movement the variables shown below are required in the Enemy script.


Objective: Allow the player to collect up to three shields and provide visual effect for each level.

Three levels of shield provide more protection. Order of layer is important to give the effect.

Duplicate the Player Shield twice setting all three shields to inactive.


Objective: Allow thrusters to overheat if used too long, requiring a cooldown system before they can be used again.

Thrusters now overheat when depleted and must wait to cool of before recharging.

Create an UI image for the afterburner indicator, naming it Thruster_Energy. Anchor it to the top left move it to just under the life indicator at roughly (x 100, y -90, z 0). Attach the Thruster_00000 sprite as the source image from GameDevHQ Filebase. Change its z rotation to 90 and set the height and width as shown below. Change the image type to filled, fill method vertical and fill origin top. …


Objective: Add a laser powerup that that recharges the laser allowing player to fire.

Laser power up restores lasers to full power, 15.

Create 2D sprites for laser powerup and animation using Power Point or other program. Drag these sprites into Unity Assets Laser_Powerup folder, select the sprites and set texture type to Sprite (2D & UI).


Objective: Add ammo system with audio warnings to laser shots.

Ammos system, Laser Power, added to Unity game.

Limiting the number of laser shots the player can take requires an ammo system in the Player script. This system is controlled by the private int _ammo =15 variable. Using Audacity, record an audio file for low ammo warning and another for the no ammo warning, saving in a Unity compatible mp3 format. Assign these files to the AudioClip variables _powerLowClip and _powerDepletedClip using the Unity inspector.

Hal Brooks

Software engineer

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