Destroy object on collision with character

Discussion in 'How Can I...?' started by dmitry_artamonov, Apr 29, 2016.

  1. dmitry_artamonov

    dmitry_artamonov Boxer

    Joined:
    Mar 15, 2016
    Messages:
    16
    Likes Received:
    5
    Hi Boxers,

    Any thoughts how an object / enemy can be destroyed (disappeared) on collision with character?


    Thanks
     
    Jakeyles likes this.
  2. dmitry_artamonov

    dmitry_artamonov Boxer

    Joined:
    Mar 15, 2016
    Messages:
    16
    Likes Received:
    5
    Found it: make your character as an object, add it to scene, connect character with this clone, set it behind character to be invisible and choose collide and destroy enemy option for this object.
     
  3. heathclose

    heathclose Miniboss Boxer

    Joined:
    Jan 28, 2016
    Messages:
    1,810
    Likes Received:
    1,025
    or you could just add health to your character
     
  4. dmitry_artamonov

    dmitry_artamonov Boxer

    Joined:
    Mar 15, 2016
    Messages:
    16
    Likes Received:
    5
    This looks much easier. Will try it, thanks!
     
  5. dmitry_artamonov

    dmitry_artamonov Boxer

    Joined:
    Mar 15, 2016
    Messages:
    16
    Likes Received:
    5
    I've tried to add health to character but it seems there is no affect on object destroy. Maybe I'm doing something wrong? I have object preset Enemy with Fixed type, No Collide and Destroy Character.
     
  6. VectologyGames

    VectologyGames Serious Boxer

    Joined:
    Oct 5, 2015
    Messages:
    529
    Likes Received:
    473
    @dmitry_artamonov Here is how you do it:

    1. Make sure your character can inflict damage to other objects by adding a damage component to the character.

    Screenshot 2016-05-01 10.25.52.png



    2. Next, add a damage and heath component to the enemy with the values pictured here

    Screenshot 2016-05-01 10.26.10.png


    3. And finally, drag out an instance of the enemy to the canvas and apply these settings. The character will now be able to destroy an object.

    Screenshot 2016-05-01 10.26.54.png
     
    Last edited: May 1, 2016
  7. dmitry_artamonov

    dmitry_artamonov Boxer

    Joined:
    Mar 15, 2016
    Messages:
    16
    Likes Received:
    5
    VectologyGames Thanks for detailed answer! Finally, adding to character both health and damage components with 1 values worked for me.
     
    Jakeyles likes this.
  8. jimmiethekid

    jimmiethekid Boxer

    Joined:
    Feb 19, 2019
    Messages:
    27
    Likes Received:
    15
    what if you want to destroy object 1 .. but still have character die with other objects? Like Mario Bros game, where the character can hit objects and break them and then also be killed?
     
    ANKIT GAUTAM likes this.
  9. ANKIT GAUTAM

    ANKIT GAUTAM Boxer

    Joined:
    Dec 2, 2018
    Messages:
    2
    Likes Received:
    0
    I have the same problem as jimmiethekid. Can anyone help?
     

Share This Page