Coding Question

Discussion in 'Buildbox 3.0' started by fredi, Sep 26, 2018.

  1. fredi

    fredi Avid Boxer

    Joined:
    Feb 3, 2016
    Messages:
    102
    Likes Received:
    11
    I build my own asset with two triangles = star.
    After collide with the character I want destroy the hole star. How can I destroy the second star (without colliding) over coding? Thanks from Newbie ;-)
     
  2. particles

    particles Avid Boxer

    Joined:
    Aug 31, 2018
    Messages:
    337
    Likes Received:
    242
    So you have two stars and want to destroy one by one after the collision with Character, right?

    1. Add If Collide Node in your Star Object
    2. In If Collide Choose your Character in Affected Asset
    3. add new Remove Node and connect with If Collide.
     
    fredi likes this.
  3. fredi

    fredi Avid Boxer

    Joined:
    Feb 3, 2016
    Messages:
    102
    Likes Received:
    11
    Thanks. Exactly I have done this before. But I hang the star to high, so only one triangles was collided.
     
  4. DanFarfan

    DanFarfan Avid Boxer

    Joined:
    Sep 22, 2018
    Messages:
    101
    Likes Received:
    42
    Connect the output of the working Collide component to the input of a Script component.
    In the Script's function signal() add these 2 lines of code.

    let other_triangle_ent = this.scene().find("OtherTriangle")[0];
    other_triangle_ent.component("If Collide").emitSignal("Collide", true);

    I have not tested this, but I've used similar before.
    Of course, use your name for the other triangle where I have "OtherTriangle"

    Good luck
    @DanFarfan
     
    particles and fredi like this.

Share This Page