Screen Drag Not Working In New Layout

Get help using Construct 2

Post » Tue Feb 07, 2017 4:43 pm

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 :)
B
15
S
8
G
7
Posts: 255
Reputation: 5,368

Post » Tue Feb 07, 2017 5:05 pm

Second layout is probably same size (or smaller) then the viewport.
(Layout size in the Layout properties versus Window size in the Project properties)
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Feb 07, 2017 5:47 pm

99Instances2Go wrote: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 :?
B
15
S
8
G
7
Posts: 255
Reputation: 5,368

Post » Tue Feb 07, 2017 5:53 pm

Possible you have the events on an event sheet that is not assigned to the layout.
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Tue Feb 07, 2017 6:07 pm

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.
B
15
S
8
G
7
Posts: 255
Reputation: 5,368

Post » Tue Feb 07, 2017 7:47 pm

-Silver- wrote:
99Instances2Go wrote: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').
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Feb 07, 2017 7:53 pm

99Instances2Go wrote:
-Silver- wrote:
99Instances2Go wrote: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 :P

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!
B
15
S
8
G
7
Posts: 255
Reputation: 5,368

Post » Tue Feb 07, 2017 11:29 pm

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Feb 08, 2017 9:08 pm

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.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 32 guests