Adding new enemy types
In the last article, I implemented a new powerup that has a negative affect on the player when collected. Today, I’m going to be continuing the second, and final, phase of the GameDevHQ 2D Game Development Certification track. In this article, I’ll be implementing new enemy types for the player to contend with! The requirement reads as follows:
- Create enemy types that can fire & damage the player
- Create enemy type with unique projectile. (i.e.. Laser beam, heat seeking, etc.)
- Unique Movement Behavior (zig-zag, wave, etc.)
For this requirement I’ve already created a lot of the functionality in different movements in different waves. I decided to distinguish my enemies visually by pulling in some new graphics for two of the three enemy types I'll have. I created new prefabs for each type, Drone, Scout, and Ranger and modified the sprite for each.
Next, I decided to give the Drone enemy a Laser beam type weapon that was different from the normal laser fire. I imported some new graphics, created a variant prefab from the laser prefab and replaced the normal laser script with a laser beam script on the variant prefab. the script finds the bottom of the viewable screen area, performs a ray cast and draws a line from the enemy ship to the bottom edge of the screen.
I then reassigned the new enemy prefabs each to different waves in the game.
In this article, I implemented new enemy types for the player to contend with. Next time, I'll be adding balanced spawning between enemies and powerups! If you enjoyed this article, or want to come along with me as I progress on my journey, follow me at gamedevchris.medium.com.