Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Making an object shoot in Unity


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Bubu Bhat   Members   -  Reputation: 117

Like
-1Likes
Like

Posted 15 March 2014 - 10:16 AM

I'm just beginning to learn Unity basics. I hardly know languages like C# or Javascript. So I need some help in 'shooting' in unity. Now given, shooting means a huge topic, I'll try to narrow it down to what exactly I need.

 

I have my Charactercontroller, which can move around forward/backward sideways etc. I learned it from youtube. Now what I want is to get a very basic idea of how EXACTLY AI Shooting works. For e.g. I have a sphere, scaled it appropriately to make it look like a tower etc. Now I want that tower to shoot flames(if possible) at my player character. I'm not going into details of placing guns or barrels etc. No bells and whistles for now.

 

I tried to learn it from youtube but the problem is most of the videos come with asset sets and models ready. I don't want to use those now. Nothing made by others.

 

I hope I've made my problem clear...If anyone can help me with a script(with some documentation, if possible), it'd be of great help. 



Sponsor:

#2 frob   Moderators   -  Reputation: 22783

Like
0Likes
Like

Posted 15 March 2014 - 02:50 PM

Lots of ways to do it.

One might be to have one of the update functions (probably FixedUpdate) that rotates the tower toward the player if it within an adjustable difference. When it reaches close enough, have a flame particle system turn on and increase damage to the character over deltatime based on distance.

Or, instead of turning on a particle system (or possibly in addition to it) launch a small object out of the tower in a direction facing forward. Make a co-routine to self-destruct the object after a short time. Add a physics object to the prefab with the trigger checkbox checked, then when it collides with something, if the something is a player, cause he player to take damage.

Or, create a large sphere around the tower to indicate its are of effect, and inside the object's update if a character is in range have the effect (whatever it is) like damage or speed reduction get applied to it.

Need more options?

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#3 ferrous   Members   -  Reputation: 2146

Like
0Likes
Like

Posted 15 March 2014 - 08:21 PM

I'm just beginning to learn Unity basics. I hardly know languages like C# or Javascript. So I need some help in 'shooting' in unity. Now given, shooting means a huge topic, I'll try to narrow it down to what exactly I need.

 

I have my Charactercontroller, which can move around forward/backward sideways etc. I learned it from youtube. Now what I want is to get a very basic idea of how EXACTLY AI Shooting works. For e.g. I have a sphere, scaled it appropriately to make it look like a tower etc. Now I want that tower to shoot flames(if possible) at my player character. I'm not going into details of placing guns or barrels etc. No bells and whistles for now.

 

I tried to learn it from youtube but the problem is most of the videos come with asset sets and models ready. I don't want to use those now. Nothing made by others.

 

I hope I've made my problem clear...If anyone can help me with a script(with some documentation, if possible), it'd be of great help. 

 

Here is a tutorial that covers how to do tower defense turrets.  It's quite detailed, and covers the basic AI of a rotating turret that shoots: https://cgcookie.com/unity/cgc-courses/unity-tower-defense-course/


Edited by ferrous, 15 March 2014 - 08:21 PM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS