2D Game Dev Journey — Day 24: New Enemy and Enemies Destroying Pick-ups

Welcome to 2D Game Dev Journey — Day 24: New Enemy and Enemies Destroying Pick-ups. Today I go over how I implemented a new enemy with lasers, and a mechanic for enemies to destroy power-ups.

Starting Point & Setup

Today we will be starting right where we left off in 2D Game Dev Journey — Day 23: Aggressive Enemy and Enemy Shields.

To get set up for today, I went ahead and created the enemy type that will represent the new one we create today.

New Enemy Type

Now when it comes to this enemy type, I pretty much am considering it to be a pre-boss. As such, its attack will be a pretty devastating one, but one the player can still feasibly maneuver around. After some code implementations, my pre-boss enemy looks like the following:

As can be seen, each laser does one health of damage to the player if they come in contact. This enemy also does not shoot until it notices the player is within the trajectory of one of its lasers. If the player is detected, it slows down, preps the shot, and then speeds up a bit more once fired. I will probably balance this enemy a bit more in the future, but this is good for now.

Enemies Destroy Pick-ups

For this one, all we want to do is give all of the enemies the ability to do destroy a power-up if they find themselves in front of one. This is where, yet again, raycasts come in handy. After some coding implementation, I got the result below.

Conclusion

Thanks for checking in and reading today’s article. Tomorrow I will be creating a homing missle power-up. If I have made any mistakes, please let me know so I can correct them for future readers. If you would like a more in-depth tutorial about anything I went over today, let me know and I will take the time to write something up.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

5 Coding Games You Should Play

JWT Chalenge 1 walkthrough

How to Generate a QR Code in Python

CMake: the Case when the Project’s Quality is Unforgivable

Convert a PDF to PDF/A in Python

BLoC design pattern with Angular

Capsule to Hubspot Migration: Drive your Business to its Full Potential — Data2CRM

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
Gabe Gomez

Gabe Gomez

More from Medium

My journey becoming a Unity game developer: 2.5D

Adding a burst laser powerup

Damage VFX Using Animated Sprites In Unity

2D Mobile: Setting Up The Player