2D Game Dev Journey — Day 25: Homing Missile

Welcome to 2D Game Dev Journey — Day 25: Homing Missile. Today I go over how I implemented the homing missile power-up which tracks and goes towards the nearest enemy.

Starting Point & Setup

Today we will be starting right where we left off in 2D Game Dev Journey — Day 24: New Enemy and Enemies Destroying Pick-ups.

To get set up for today, I went ahead and created the missile sprite we will be using for this power-up.

I also went ahead and added in the power-up collectible with its animations for the homing missile.

Homing Missle Implementation

Now if I am being honest, the implementation of this homing missile was a lot harder than I initially thought it’d be. This is for a variety of reasons, but one of the main reasons was making sure my rotation matched up, or at least looked close enough, to the forward direction the missile was traveling. After a few different tries and code implementations, I was able to get the result below:

Even with today’s challenges, there are a few things I am proud of. For one, I was able to get more comfortable with quaternions today as they were the means of getting my missile rotations correct.

part of the code for proper rotation

I was also able to figure out how to make the missiles track different enemies unless there is only one enemy currently spawned (which can be seen in the GIF).

Conclusion

Thanks for checking in and reading today’s article. Tomorrow I will begin balancing out the spawning, as well as creating a wave system. 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

WORKING WITH EXCEL SPREADSHEETS

Stop Music when Zoom Meeting is On

What is High-Level-Programming Language?

PIZZA FOR MUSIC 1 FULL VERSION Featuring The Children’s Choir Of Dindaeng

How to Migrate from SuiteCRM to Salesforce.com in 6 Simple Steps [+Video] — Data2CRM-2018

Rebuilding HDP Hive: patch, test and build

Share the settings with the whole team — a year later

🤩 Breaking news - The HotMoon Airdrop Token start working!

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

Different Lights in Unity.

Managers, Main Menu and Loading screen

Unity Performance Optimization: Animation Module

Unity’s Tilemap System