Fly Like a Hornet, Sting Like a Bee

Dylan Murayama
2 min readDec 9, 2020

Day 33–12/8/20

Today, my main task was to finish our aggressive enemy type. This was a fairly straightforward simple task, and essentially my main feature of this enemy was to have the enemy charge towards the player. Of course, I may have gone a little past the scope of MVP, as I also implemented a flash feature to indicate the enemy is charging, as well as a rotational lerp to make the enemy appear less static. And one other feature, which actually was part of our MVP, is the shield that activates when charging.

To start things off, I incorporated a distance and movetowards function. Basically, if the enemy was greater than a specified distance the enemy moved towards the player at a moderate speed. Once the enemy got within a certain range, the enemy charges straight forward at a much higher pace. When the charge is triggered the enemy will begin violently flashing red.

As I mentioned, I had also incorporated a rotational Lerp feature (Thank You, Ryan! I may have referenced your lerp script ). Anyway, this Lerp function controls the y rotation of the enemy and gives it a little more life and a feeling as if the enemy is actually hunting down the player.

The next challenge I encountered was to stop my shield from rotating with my enemy. This is probably also beyond MVP but it was bugging me… a lot. Anyway, shortly after some googling, I came across the code on the right which allows child objects to ignore the rotation of a parent object. Now instead of my 2D shield turning sideways it now stays static regardless of how much the enemy rolls over.

--

--