How To Make A Weapon Atached To A Player?

Discussion in 'How Can I...?' started by Coyowl, Feb 23, 2017.

  1. Coyowl

    Coyowl Boxer

    Joined:
    Nov 23, 2015
    Messages:
    94
    Likes Received:
    56
    Hello,

    As the title suggests I am trying to attach a weapon to my character, but when the weapon collides with an enemy it destroys itself. The only workaround I found was to set it to "destroy all" and make the collision box smaller so it cant collide with the player but if it collides with the ground, it destroys it.

    Is there any other way?

    Thanks!
     
  2. Appymes

    Appymes Avid Boxer

    Joined:
    Nov 11, 2016
    Messages:
    268
    Likes Received:
    59
    Coyowl likes this.
  3. Coyowl

    Coyowl Boxer

    Joined:
    Nov 23, 2015
    Messages:
    94
    Likes Received:
    56
    Thanks for the help, but in the example you use a gun with bullets.
    I am trying to make something like a sword, to actually collide with the enemy
     
  4. Appymes

    Appymes Avid Boxer

    Joined:
    Nov 11, 2016
    Messages:
    268
    Likes Received:
    59
    Coyowl likes this.
  5. Coyowl

    Coyowl Boxer

    Joined:
    Nov 23, 2015
    Messages:
    94
    Likes Received:
    56
    I am trying to use only one button for moving.
    Is it possible to spawn an object repeatedly and destroy it after 0.01 sec?
     
  6. Appymes

    Appymes Avid Boxer

    Joined:
    Nov 11, 2016
    Messages:
    268
    Likes Received:
    59
    A single button to move and hit with the sword?

    You can use the first example that shoots, put a very fast shot and the bullet is hidden at the same time it shows the animation of the sword. The result would be the same.
     
    Coyowl likes this.
  7. Appymes

    Appymes Avid Boxer

    Joined:
    Nov 11, 2016
    Messages:
    268
    Likes Received:
    59
  8. spicedbeangames

    spicedbeangames Miniboss Boxer

    Joined:
    Mar 31, 2016
    Messages:
    1,389
    Likes Received:
    596
    Make a new game object - call it shield. Use advance component to give it health - as much as you want before it breaks or give it a lot of health if you dont want it to be destroyed.

    Drag this shield in to your character default animation. You may need to add the shield into each animation for movement and attacking. You can also create an animation for the shield if its being attacked and drag that in to the attack animation (as an example)
     
    Coyowl likes this.
  9. lawchin

    lawchin Boxer

    Joined:
    Nov 16, 2016
    Messages:
    9
    Likes Received:
    5
  10. meremy

    meremy Avid Boxer

    Joined:
    Aug 26, 2016
    Messages:
    134
    Likes Received:
    66
    Isn't it easier just to set your sword's Health to 9999 ? That way it kills opponents but doesn't get destroyed itself
     
    Last edited: Feb 24, 2017
    Coyowl likes this.
  11. Coyowl

    Coyowl Boxer

    Joined:
    Nov 23, 2015
    Messages:
    94
    Likes Received:
    56
    Thank you all for your replies, I will probably go with the health on the weapon ;)
     

Share This Page