Day 5 - Adding turret functionality
Today I have been hard at work at creating the turret projectiles, making them hit and then after 20 hits getting the enemy destroyed. I also added a range to the turrets, that only allows them to shoot a maximum of 30 units (1 block = 10 x 10 units). When the turrets are out of range, they also suppress fire.
Distance measurements
I created a function to check the distance to the enemy. It creates a float called "distance" and assigns a Vector3.Distance to it. Afterward, it compares the distance with the range I defined (30 units) and if it is in range it starts shooting and orienting its turret head towards the enemy.
Bullets
The bullets are spawned by a particle system. The particle system spawning (emission) gets toggled by the logic mentioned above. When the particle hits the enemy, it sends out an "OnParticleCollision" call. The enemy then processes the call internally by subtracting some HP and if it's HP drops to 0, it destroys itself.
Thanks for reading!

Posted using Partiko Android
Thank you so much for being an awesome Partiko user! You have received a 4.85% upvote from us for your 705 Partiko Points! Together, let's change the world!
Congratulations @loler555! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :
Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word
STOPDo not miss the last post from @steemitboard:
Congratulations @loler555!
Your post was mentioned in the Steem Hit Parade for newcomers in the following category:
I also upvoted your post to increase its reward
If you like my work to promote newcomers and give them more visibility on the Steem blockchain, consider to vote for my witness!