Galaxy Shooter 2D — Bomber and Toxic Enemies

Don’t worry Rookie! Help is on its way!

Pablo Gómez Platón
3 min readJun 5, 2021

The game is feeling more complete now with all the features I’ve been adding to it. The one thing it’s lacking right now is more enemies. Today, two new enemies join the fight: Bomber and Toxic!

Bomber

The Bomber is not that threatening alone, however, it becomes deadly in groups, dropping bombs that will explode into various lasers. So beware, Bombers will definitively catch you off guard with their bombs.

Characteristics:

Zig-Zag movement. With the use of Sine waves, I implemented it with ease. And when it dies, it will move towards the last direction it was moving to.

Movement Method

Drops Bombs. The Bomber selects each time a point where to drop the bomb whenever it becomes visible in the screen, and can only drop one again once it gets teleported up.

New Projectile: Bombs.
- When instantiated, it will move downwards up to a certain distance from its spawn position, and slows down when it gets closer to that distance. This creates anticipation, and helps the player avoid the bomb / lasers.

- Shoots 8 lasers in all directions (360 degrees). The Firing system is flexible, and I can change dynamically the number of lasers fired.

Toxic

Equiped with a Weak Shield and Toxic Gas Tanks, the Toxic enemy will make sure to restrict the player from moving through some areas of the screen.

Characteristics:

Shielded Enemy. The shield will protect Toxic from one projectile, and when hit, it will eject a Toxic Smoke and it will move faster.

Toxic Smoke. When spawned, the toxic smoke will remain in the screen for 5 seconds, and if the player enters the smoke area, it will damage the player every 0.25 seconds while the player remains inside it and is not in an invincibility state.

The Toxic Smoke is just a Particle System with a Circle Trigger Collider, and the duration and the area damage dealer are all handled with Coroutines.

Why do I use a Coroutine for the Duration of the Toxic Smoke? After 5 seconds, the smoke particles are still present, and the Smoke GameObject needs to be disabled or destroyed. Using WaitUntil, I can pass a Func Delegate which checks if the particle count is equal to zero. I could just use the Update method and check every frame that condition, but I find it to be ugly.

Bomber and Toxic in Action

--

--