• Advertisement
Sign in to follow this  

Unity Making an object shoot in Unity

This topic is 1406 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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. 

Share this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
  • Advertisement
  • Popular Now

  • Advertisement
  • Similar Content

    • By eldwin11929
      We're looking for programmers for our project.
      Our project is being made in Unity
      Requirements:
      -Skills in Unity
      -C#
      -Javascript
      -Node.js
      We're looking for programmers who can perform a variety of functions on our project.
      Project is a top-down hack-and-slash pvp dungeon-crawler like game. Game is entirely multiplayer based, using randomized dungeons, and a unique combat system with emphasis on gameplay.
      We have a GDD to work off of, and a Lead Programmer you would work under.
      Assignments may include:
      -Creating new scripts of varying degrees specific to the project (mostly server-side, but sometimes client-side)
      -Assembling already created monsters/characters with existing or non-existing code.
      -Creating VFX
      -Assembling already created environment models
      If interested, please contact: eldwin11929@yahoo.com
      This project is unpaid, but with royalties.
       
      ---
      Additional Project Info:
      Summary:
      Bassetune Reapers is a Player-verus-Player, competitive dungeon crawler. This basically takes on aspects of dungeon crawling, but with a more aggressive setting. Players will have the option to play as the "dungeon-crawlers" (called the 'Knights', or "Knight Class", in-game) or as the "dungeon" itself (literally called the 'Bosses', or "Boss Class", in-game). What this means is that players can choose to play as the people invading the dungeon, or as the dungeon-holders themselves.
      Key Features:
      -Intense, fast-paced combat
      -Multiple skills, weapons, and ways to play the game
      -Tons of different Bosses, Minibosses, creatures and traps to utilize throughout the dungeon
      -Multiple unique environments
      -Interesting, detailed lore behind both the game and world
      -Intricate RPG system
      -Ladder and ranking system
      -Lots of customization for both classes s of customization for both classes
    • By RoKabium Games
      Custom coffee mugs have arrived... More caffeine!
      Have a great weekend everyone! 
      #gamedev #indiedev #sama #caffeine
    • By Atwo Studios
       
      Hey guys,

      Anthony here from Atwo Studios bringing you some new updates for the new year!
      In this video I go over our game ROY, the new games and some general updates to the company!

      If you have not checked out ROY feel free to give it a try! Many people have said they enjoyed the game thus far!
      ROY: https://goo.gl/o6JJ5P
       
    • By Affgoo
      https://play.google.com/store/apps/details?id=com.NE.Alien
      still a lot of work to do, but its pretty stable  please let me know what you think <3
      Atlas Sentry is a game of destroy everything. Using your turret, simply swivel and shoot your way to victory, upgrading your weapons to unleash destruction on the variety of spaceships. The bigger your combo’s the more score you get! Earn silver as you play and then purchase new weapons and abilities to better deal with your enemy. Different enemies use different tactics and weapons, work out your own priorities in their destruction order. 

      Features: 
      **2 different game modes 
      **A level select mode with 20 difficult levels including a final boss, can you defeat it? **Arcade mode of endless destruction, how long will you last? 
      **High scores to compete against others, see who can take the top spot. 
       
    • By Chamferbox
      Chamferbox, a mini game asset store has just opened with some nice game assets, 
      Here you can find a free greek statue asset 

      Also check their dragon, zombie dragon and scorpion monster out:



      They're running the Grand Opening Sale, it's 30% off for all items, but for gamedev member, you can use this coupon code:
      GRANDOPEN
      to get 50% off prices What are you waiting for, go to
      http://chamferbox.com
      and get those models now!

      View full story
  • Advertisement