Day 20 Boss time!

Austin Bryant
3 min readDec 23, 2020

This morning was a little rough. I thought I had everything to go except my SmartBomb segment for my game set so I start the boss for my game.

After a ScreenShare this morning, I realized my code was not working the way I had left it yesterday. So I went to work to ensure all my work yesterday was still intact.

Turns out while I was tweaking my code yesterday I had forgotten to test it.

I reworked my code today and then tested all the segments I had worked on yesterday. It all worked.

After this part of the morning I moved on to finish my “SmartBomb”.

I had to create a new script for it and made sure only Player could call for it. I ran some tests and adjusted my code. It worked the way I needed it to. It’s only flaw is that if the player grabs this powerup and no enemies are on the board that it comes back as an error. This only stays until another enemy appears. So I am not worried about it.

Finally I got to work on my Boss enemy.

I found a suitable sprite and then started its movement code.

I needed the boss to come from off screen into view and the stay around the area. I decided to add a figure 8 motion while it’s on screen when the player fights this final enemy.

First I had written some code that told the Boss to come off screen and when it hit center to stop moving. This part was easy enough. So next the figure 8.

The figure 8 movement was a bit tough. I knew I needed some Trigonometry code to add in. So I took to google to find the answer.

At first glance I found an algorithm to add in. The code I found seemed straightforward enough but the syntax was misleading because it was not in C#.

Next I asked my fellow interns. Jared was nice enough to take time and respond to help me find the answer. The previous answer I found creates a figure 8 motion in 3D space and Jared helped me find a solution for 2D. Thanks Jared!

So with the algorithm found and written, I was ready to test my code. This did not turn out the way I had thought.

The script kept trying to check for the Y axis and kept my Boss from completing the figure 8 motion.

After some thought and a little research I found it best to create a separate code fo the start motion and then switch over to another script.

Thanks to Unity’s easy to use interface and some awesome c# syntax, I was able to have the boss start off screen then move into position. Once there it turns off the start motion script and turns on the figure 8 script.

Doing things this way does create a time laps of about 1/2 a second shown in my GIF below. I’m sure once I get better at this I’ll be able to create this behavior in a more fluid motion but hey, I did what I was setting out to do!

Very productive day and I am ready for my next challenge tomorrow. Creating the Boss’ firepower and health!

Boss Movement!