0 Favourites

Screen Drag Not Working In New Layout

  • I followed this tutorial (with a few of the suggested tweaks in the comments) to get a screen drag system working in my game last year. It worked amazingly well on my first layout, but for some reason I can't get it working on other layouts. Slightly frustrating...

    Someone mentioned in the comments of the tutorial that he can only get this to work when unbounded scrolling is enabled, which causes its own problems of course. I tried doing the same and yep, the scrolling now works but I can scroll outside the borders of the game screen. The original layout that it works perfectly on doesn't have unbounded scrolling enabled though, so I can't figure out what I'm missing. Any idea if it's something simple I'm forgetting to set up on the new layout to allow this to work? I have no idea why it works on one layout but not the other...

    To clarify it's:

    Mouse Right Click is Down

    --Trigger Once While True

    ---- System Set Value ClickPosition to Mouse.X

    ---- System Set Value ClickPositionY to Mouse.Y

    --System Every Tick

    ---- System Set Scroll X to scrollx+(ClickPosition-Mouse.X)

    ---- System Set Scroll Y to scrolly+(ClickPositionY-Mouse.Y)

    Thanks for reading

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Second layout is probably same size (or smaller) then the viewport.

    (Layout size in the Layout properties versus Window size in the Project properties)

  • Second layout is probably same size (or smaller) then the viewport.

    (Layout size in the Layout properties versus Window size in the Project properties)

    1920x1080 for everything. For both Layout and Project Settings

  • Possible you have the events on an event sheet that is not assigned to the layout.

  • Thanks, but that's not the issue either. It's definitely assigned, and I added a "play sound effect" command in there too to make sure the right-click was registering, just in case there was an issue with the Mouse object assigned in the first layout not working in other layouts. Hmmm, maybe it's the global variable? I'll keep poking around.

  • > Second layout is probably same size (or smaller) then the viewport.

    > (Layout size in the Layout properties versus Window size in the Project properties)

    >

    1920x1080 for everything. For both Layout and Project Settings

    So, yeah i gambled right.

    If they are the same, then you cant 'scroll' the layout eh. (when unbound scrolling set to 'no').

  • >

    > > Second layout is probably same size (or smaller) then the viewport.

    > > (Layout size in the Layout properties versus Window size in the Project properties)

    > >

    > 1920x1080 for everything. For both Layout and Project Settings

    >

    So, yeah i gambled right.

    If they are the same, then you cant 'scroll' the layout eh. (when unbound scrolling set to 'no').

    Ahhh, okay, but then... why does scrolling work for my original layout? Because that's also got a layout size of 1920x1080, unbounded scrolling disabled. I must have done something to that layout to enable scrolling to work, but I've long since forgotten

    Also, so this makes more sense, I have a zoom in function. So fully zoomed out, yeah, no scrolling anywhere. But when I zoom in I should be able to scroll. That works on the first layout but not the others (zooming works everywhere, scrolling never). Maybe the issue is there..?

    I'm really sorry for my incompetence!

  • I'm really sorry for my incompetence!

    Oh gosh, dont be. It is just hard to help with no capx. It always comes down to guessing and gambling.

    I did't get that you zoom, and that has some complications.

    This helps ?

    https://www.dropbox.com/s/1njzsr6mzgjjx ... .capx?dl=0

  • For future reference.....

    The capx was PM'd to me. It is a game in progress with a lot of potential.

    The thing is this ...

    Say one has a layout with Layer1, Layer2, and Layer3.

    Dimensions of the layout is the same as the project window.

    Unbounded scrolling is off.

    Now if you zoom Layer1 and Layer2 (not layer3), one would expect to able to scroll the layout inside the project window.

    That will not happen if the parallax X/Y for Layer3 is still set to 100/100.

    The layout will not pass the 'unbounded scrolling' check when one layer cant scroll pass the boundings.

    Because it is NOT zoomed as Layer1 and Layer2 are.

    Got to set the parallax X/Y for Layer3 to zero/zero to exclude it from the 'unbounded scrolling' check.

    As always, my English is still not improving.

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