GameDevHQ Intensive Training Week 03 Recap 📝🤫
Published: 2021-03-07 22:25:08

I think posting one a week about the intensive training is the way to go🤔

For a quick idea of what i did on week 3, here my latest video of week 3 recap:
https://youtu.be/juMhkbUhjJg

Now, let's see how week 3 went.

This week we were focusing on the Attack System For Towers, this where the following task:

Attack System for Towers

Modify existing code base to only fire when an object becomes in range
Fire at the first target in radius and follow it till out of range. Then attack the next.
Sort of Queue System
If no targets in range, do not fire
Destroy System (cleanup) 
Damage Enemies
Play Death Animation
Destroy after 5 seconds or end of wave

At first it seems daunting but once you put in to practice breaking each task into little pieces and using pseudo code then you will see how to tackle it…….in my case i broke it in to microscopic piece in order to work on it😅

At the beginning of the week you start off seeing the Week’s kick off video that will explain / show what to use in order to work on the task, during this I learn about the Queue System.

The Queue System has the logic of first in first out, for the goal of this week I thought this was the way to go; turn out it wasn't.

At first, when using the Queue system, the turret actually follows the first enemy regardless how many enter the attack range; once the first enemy leaves the attack range the turret will aim to the next on the queue list.

Until now everything seem to work wonderfully 👆

Once my code started to complicate more when adding to remove health that's when I was getting errors of empty Queue when the system knew it was empty it still was giving eros, I got so much code that I overpopulated the onTriggerStay() method.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwocq58x86jet5sqh7ti.png)

Once I talked to one of the instructors I was hinted to use a List<GameObject> and not a Queue System; I will be lying if i say that the change was smooth.


At first I made the basic implementation of the turret following the enemy and it works, but there was a point trying to work the code from scratch / starting new that gave me like a small metal block and I was not able to see how can i target the active enemy if there's a second enemy on the attack range. Thanks to the Intensive Training community help I was able to make the weapon aim at the target and stay with the first that entered the attack range and now my code looks more  clean.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x02e28qhnvg0pr8hsovy.png)

I did use A LOT of events on my code, they're soooooooooo awesome to use.

The missile weapon was the one that really got me mad. He can only remove enemy health if one of its missiles hit an enemy and Saturday night that logic was working; once I started to film my video for the recap it did not want to work. I cheated my way that the missile can remove health regardless who is the active target soooooo whatever enemy the missile hit will lose life...for me that's a win…..a cheat win but it work 😄

Others of my group are doing OMG AWESOME and I am really happy with what they're doing. My personal aim for this game / training is to try and make it a AR application and enjoy the process of learning how to be better at code.

I know my post needs to be more descriptive on how I work around the code logic and I will work on that😉.

For now let's get ready for week 4.

Lets keep coding,

TO BE CONTINUED 😎