How do I use the Scroll To Position feature on the second layer?

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • So I set up a 2D Zelda-style dungeon which scrolls to the next room of the dungeon using

    Scroll to (((ViewportLeft(1) + ViewportRight(1))) / 2)

    And similar variations. I'm sure there's a better workaround, but I finally got it to work perfectly.

    Then I added a HUD layer, and instead of scrolling the expected distances, it references the HUD for my Viewport X/Y variables. (At least I think this is what is happening.)

    Can anyone tell me how to make the Scroll To Position use the viewport location on the SECOND layer instead of the first? Thank you in advance!

    Tagged:

  • On your HUD layer properties, set the Parallax to 0% x 0%.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I did that, and the HUD stays in place as you'd expect. It's just that, when transitioning between dungeon rooms, it doesn't subtract from the values of where the viewport is located on layer 2 anymore, but instead uses the values on the HUD layer. This leads to the viewport scrolling to something like 305, -305 instead of (ballparking) 1800, 4000. The math is all right, but it is using the reference of the viewport on the HUD layer instead of the viewport on layer 2, which is where I'm trying to actually adjust from.

    I hope that makes sense lol. But thank you for replying! I really want to figure out what's going on here if at all possible. I'd be glad to get more specific if anyone is willing to take the time to go over it. Just let me know what info you (or anyone) might need and I'll post again!

  • You may have changed your viewport numbers around. The number within the parenthesis in the ViewportLeft()/ViewportRight() expressions reference the layer number, or I believe you can reference a layer by name if you put it in quotations.

  • Thank you SO much! I had tried doing it by changing the number in the parentheses, but I hadn't tried typing out the layer name in quotes within the parentheses. You have no idea how thankful I am for your help. Seriously. You're the best!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)