create account

Learning Unity3D devlog - Day 05 by loler555

View this thread on: hive.blogpeakd.comecency.com
· @loler555 ·
$1.94
Learning Unity3D devlog - Day 05
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!
--

![](https://d1vof77qrk4l5q.cloudfront.net/img/1c4ef22617f40e771a52db71644502d6b992da56.gif)

Posted using [Partiko Android](https://steemit.com/@partiko-android)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 757 others
properties (23)
authorloler555
permlinklearning-unity3d-devlog-day-05-1hbi8xnx
categoryunity3d
json_metadata{"tags":["unity3d","gamedev","en","games","blog","partiko"],"image":["https://d1vof77qrk4l5q.cloudfront.net/img/1c4ef22617f40e771a52db71644502d6b992da56.gif"],"app":"partiko"}
created2019-02-28 14:25:18
last_update2019-02-28 14:25:18
depth0
children4
last_payout2019-03-07 14:25:18
cashout_time1969-12-31 23:59:59
total_payout_value1.515 HBD
curator_payout_value0.421 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,192
author_reputation5,449,445,993,461
root_title"Learning Unity3D devlog - Day 05"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id80,538,012
net_rshares3,314,356,903,769
author_curate_reward""
vote details (821)
@arcange ·
Congratulations @loler555!
Your post was mentioned in the [Steem Hit Parade for newcomers](https://steemit.com/hit-parade/@arcange/daily-hit-parade-for-newcomers-20190228) in the following category:

* Upvotes - Ranked 6 with 819 upvotes

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](https://steemit.com/~witnesses)!
properties (22)
authorarcange
permlinkre-learning-unity3d-devlog-day-05-1hbi8xnx-20190228t171347000z
categoryunity3d
json_metadata""
created2019-03-01 16:14:33
last_update2019-03-01 16:14:33
depth1
children0
last_payout2019-03-08 16:14:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length449
author_reputation1,146,616,139,479,238
root_title"Learning Unity3D devlog - Day 05"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id80,589,779
net_rshares0
@partiko-promoter ·
None
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!
properties (22)
authorpartiko-promoter
permlinkre-learning-unity3d-devlog-day-05-1hbi8xnx-20190228t142524
categoryunity3d
json_metadata""
created2019-02-28 14:25:24
last_update2019-02-28 14:25:24
depth1
children0
last_payout2019-03-07 14:25:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length156
author_reputation203,662,337,760
root_title"Learning Unity3D devlog - Day 05"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id80,538,014
net_rshares0
@steemitboard ·
Congratulations @loler555! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td>https://steemitimages.com/60x70/http://steemitboard.com/@loler555/commented.png?201902272343</td><td>You got more than 50 replies. Your next target is to reach 100 replies.</td></tr>
</table>

<sub>_[Click here to view your Board](https://steemitboard.com/@loler555)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Do not miss the last post from @steemitboard:**
<table><tr><td><a href="https://steemit.com/carnival/@steemitboard/carnival-2019"><img src="https://steemitimages.com/64x128/http://i.cubeupload.com/rltzHT.png"></a></td><td><a href="https://steemit.com/carnival/@steemitboard/carnival-2019">Carnival Challenge - Collect badge and win 5 STEEM</a></td></tr></table>

> You can upvote this notification to help all Steem users. Learn how [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-loler555-20190228t142650000z
categoryunity3d
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-02-28 14:26:51
last_update2019-02-28 14:26:51
depth1
children0
last_payout2019-03-07 14:26:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,059
author_reputation38,975,615,169,260
root_title"Learning Unity3D devlog - Day 05"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id80,538,070
net_rshares0
@tts ·
To listen to the audio version of this article click on the play image.
[![](https://s18.postimg.org/51o0kpijd/play200x46.png)](http://ec2-52-72-169-104.compute-1.amazonaws.com/loler555__learning-unity3d-devlog-day-05-1hbi8xnx.mp3)
Brought to you by [@tts](https://steemit.com/tts/@tts/introduction). If you find it useful please consider upvoting this reply.
properties (22)
authortts
permlinkre-learning-unity3d-devlog-day-05-1hbi8xnx-20190228t150152
categoryunity3d
json_metadata""
created2019-02-28 15:01:54
last_update2019-02-28 15:01:54
depth1
children0
last_payout2019-03-07 15:01:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length359
author_reputation-4,535,154,553,995
root_title"Learning Unity3D devlog - Day 05"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id80,539,274
net_rshares0