New Enemy Detected — Enemy Types and Behaviors

He is doing his best.
The Bomber!
The Harasser!
The Sniper!
Nothing new here, just the base enemy moving down the screen.
Same logic for movement.
The Harasser has entirely different movement.
The Sniper doesn’t want to get close!
Base Enemy: Nothing new here. Move down the screen, shoot at will.
Bomber: Very similar, but we instantiate a new object (enemyBomb) and play a new sound effect.
We call this in Void Start as the object is spawned in.
This contains the logic for the light, as well as the command for it to move down the screen.
Placeholder pseudocode.
Most of this is the same as the base enemy.
This is similar to the harasser’s movement logic.
The 4 enemy types are prefabbed.
We can swap the prefabs and set those variables here instead of in code!
Line 9
The Array seen in the Inspector.
Short display of all enemy types!

--

--

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
Jack Leavey

Jack Leavey

I am a software engineer with years of experience branching into game development, specifically in Unity. Follow along for guides on creating game mechanics!