Day 17 enemy shields and missiles!

Austin Bryant
2 min readDec 18, 2020

--

Today was a productive day. I was able to get some tough segments done for my project. I was able to finish my wave code, the tougher enemies have missiles, and now some weaker enemies randomly have shields.

The first thing done was the spawn waves code. I had to put a 2 check system in place so that the Spawn Manager and the UI manager know that the wave has started or it has stopped and needed to wait for the next wave. Before doing this the timing in waves was off, no matter what I did in code.

After testing the code several times, I moved on to finish creating the enemy missile. This one got me stuck for a good chunk of the day. The first part was pretty simple. After it is fired from the enemy move toward the player. If the player is hit damage the player ( unless the player had a shield active which the shield takes the hit instead.).

The next part of this segment was troublesome. Rotate the missile in the direction of the player so the missile looks like it is seeking the player rather than just shifting side to side.

I spent several hours just trying to get the thing to rotate. I first got it to rotate but, it was rotating in a 3D space and the object was missing the player because they were never really touching on the Z axis. I finally went to some research to find the answer.

Thanks to another programmers blog, I found that calling a couple different methods, ( which were used to rotate the asteroid), plus factoring in distance, worked.

So now I have a missile that rotates toward the player and seeks the player after it is “launched”.

Finally I end my day with building random enemies that spawn with shields. Since I used the old enemy as a frame for the new enemy they both have shields. I put in a variable and only allowed a few enemies spawn with shields.

Tested all three segments and ready to move on to the next.

I am hoping to get everything done but the boss by tomorrow.

The Boss segment is going to require a lot of work since this unique gameobject needs a lot of attention in order to make it fun and difficult for the player.

--

--

Austin Bryant
Austin Bryant

Written by Austin Bryant

C# Unity Developer in training.

No responses yet