Delete Portal After It Is Used

Discussion in 'How Can I...?' started by MichKrane, Nov 1, 2016.

  1. MichKrane

    MichKrane Boxer

    Joined:
    Sep 19, 2016
    Messages:
    43
    Likes Received:
    49
    Hey I am creating a game which requires a lot of portals to be used. I just can't find a way to delete a portal after it has been used as an exit. Sure, checking the "single use" box will delete the portals that are used for the character to enter, but it seems that if a portal works as an exit it won't count as "using it" and even though the "single use" box is checked, it won't disappear when a character has exited through it. The problem is that the next time the character goes through a portal, a copy of him exits through that previous portal too and I get multiple characters, I don't want that. The nature of the game requires the portals to be close to each other (adjusting the radius won't do the trick, because the portal I want the character to move to is further away than the one I don't want him to, which is the portal I need to delete).
    Also the game is endless type and consists of many scenes that need to be played RANDOMLY, which means I can't solve the problem with different Group Id's for the portals, they HAVE TO be the same.

    I appreciate the help!
     
  2. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    You probably could make it disappear with a transform logic. Not sure if portals react to it, but if not, just use an invisible decoration object some pixels after the exit of the portal and make it travel some very few pixels with a wake up component by contact. Make it so that the object now touches de transform logic immediately after you touch the object and it will disappear together with the portal when it is linked to it.
     
  3. MichKrane

    MichKrane Boxer

    Joined:
    Sep 19, 2016
    Messages:
    43
    Likes Received:
    49
    I actually tried that and it just doesn't work. I know the trick you mentioned, but the portal seems to be UNAFFECTED by anything. It doesn't get deleted when connected to an object which gets deleted ( yes, I connected it the right way, portal is connected to that object, not the other way around). Portals are very hard to manipulate with tricks and they aren't affected by connections. I tried to connect it to an object and then I gave that object a linear velocity, just to see if the portal would move with it, and it DOESN'T!! In debug mode you can see the object moving but the portal remains still, you can even see the connection line getting bigger as the item moves further away.
     
  4. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Actually it would be the other way around. Link the object to the portal.

    Update: I just tested this myself. It works 100%.
     
  5. MichKrane

    MichKrane Boxer

    Joined:
    Sep 19, 2016
    Messages:
    43
    Likes Received:
    49
    green-portal
    blue-object (linked to portal-that is what I meant earlier, the right way, where the red dot is on the portal)
    red-transform logic

    This is not a part of my game, I just wanted to make sure that this is what you meant
    The object moves toward the transform logic, but the portal remains still
    When object hits the transform logic it disappears, but the portal doesn't
     

    Attached Files:

    • 1.png
      1.png
      File size:
      14.1 KB
      Views:
      10
    • 2.png
      2.png
      File size:
      14 KB
      Views:
      8
    • 3.png
      3.png
      File size:
      13.1 KB
      Views:
      8
  6. anngelinoo

    anngelinoo Avid Boxer

    Joined:
    Aug 23, 2016
    Messages:
    128
    Likes Received:
    40

    You can follow this tutorial
     
  7. MichKrane

    MichKrane Boxer

    Joined:
    Sep 19, 2016
    Messages:
    43
    Likes Received:
    49
    Thank both of you very much for your time and advice!
    I actually found another way to make my game work, all my scenes are randomized BUT my solution requires the same scene to NEVER play two times in a row. HOWEVER, even though all my scenes are randomized and I have set the "play cooldown" value to 3 for each one, it doesn't seem to work, the same scene sometimes appears two or three times consecutively, which breaks the game. I don't know if I am missing anything here, or if I don't understand how "play cooldown" works, but either way I am going to create a new thread in case someone can help me with this

    Once again thank you for your time and patience!
     
    anngelinoo likes this.
  8. anngelinoo

    anngelinoo Avid Boxer

    Joined:
    Aug 23, 2016
    Messages:
    128
    Likes Received:
    40
    you welcome
     

Share This Page