Search Unity

Question Scene Change on button press AND on trigger collider?

Discussion in 'Visual Scripting' started by Talashowl, Sep 15, 2020.

  1. Talashowl

    Talashowl

    Joined:
    Apr 25, 2015
    Posts:
    5
    Hello! I'm very new to Bolt, and I'm definitely an artist, not a programmer.

    I would like to initiate a scene change but only when my player is within a trigger collider AND on pressing 'E'.

    I can set it to change upon entering the trigger.
    I can set it to change upon button press.

    But I can't seem to make it wait for both to be true! Any help is appreciated, I know it's a super basic question, but I'm learning.
     
  2. guybro_thunderboots

    guybro_thunderboots

    Joined:
    Aug 27, 2015
    Posts:
    45
    Set a boolean variable called `isInTrigger` to true when the player enters the trigger. Set it to false when the player exits.
    Set a boolean variable called `isPressingE` to true when the player presses E. Set it to false when the player releases.

    When the user enters the trigger, check to see if `isPressingE` is also true. If so, change scenes.
    When the user presses E, check to see if `isInTrigger` is also true. if so, change scenes.
     
  3. Talashowl

    Talashowl

    Joined:
    Apr 25, 2015
    Posts:
    5
    I super appreciate your response! I understand that's what I'm supposed to tell the computer, but I'm having a lot of trouble wrapping my brain around what that actually looks like. I have an entirely wrong Flow Map, I'm sure...

    Are these even remotely the right nodes? Obviously the actions are there, but I'm not sure how to make both appear as true.

    Sorry, I used to be so solid with Playmaker but Bolt is really kicking my butt!

    upload_2020-9-15_16-22-32.png
     
  4. Talashowl

    Talashowl

    Joined:
    Apr 25, 2015
    Posts:
    5
    Here's the scene, just for flavor, I want to have the player able to hit 'E' to jump in the well :)

    upload_2020-9-15_16-27-33.png
     
  5. guybro_thunderboots

    guybro_thunderboots

    Joined:
    Aug 27, 2015
    Posts:
    45
    You may have to zoom in (4k monitor), but your graph should look something like this.

    upload_2020-9-15_19-59-43.png

    I'm using the "Toggle Value" Unit here because it simplifies things a bit, but I'm not the greatest Bolt graph user. Your own mileage may vary, do whatever works for you.
     
  6. Talashowl

    Talashowl

    Joined:
    Apr 25, 2015
    Posts:
    5
    Oh my gosh you. are. amazing! I was wayyy off!

    It worked perfectly! I'm hoping playing around with these will get it to click in my brain. I was playing with the 'And' function but I don't think I had the variables set up correctly at all...

    Awesome! Now I can focus on designing the levels!

    Thank you so much!!
     
    guybro_thunderboots likes this.
  7. guybro_thunderboots

    guybro_thunderboots

    Joined:
    Aug 27, 2015
    Posts:
    45
    No problem, hope you have a good time with Bolt in the future!