How to build vertical scrollbar for very high image?

Discussion and feedback on Construct 2

Post » Sun Feb 26, 2017 6:08 pm

How to build vertical scrollbar for very high image?
B
13
S
2
Posts: 95
Reputation: 861

Post » Sun Feb 26, 2017 11:12 pm

@maordany

It gets surprisingly complicated. There is no pre-built scroll bar, so you have to make your own. I just happened to make one recently, so I thought I would share a simplified version of it.

This version scrolls the whole layout (with a tall picture on it). You need a top layer that contains the scroll bar, and doesn't scroll with the rest of the layout (set its parallax to 0,0). It automatically adapts to the layout, so if you change screen dimensions and it will snap to the right side of the screen, and position and resize itself.

You can change the speed at which it scrolls by changing the ScrollSpeed instance variable in the ScrollBar sprite. You can also change the ScaleSize to make it appear bigger or smaller if necessary. This version only works with a mouse. Touch adds more complexity - like how do you properly handle multi-touch, do you want to pan around, pinch to zoom, etc...

If you were wanting a scroll bar to scroll an image inside a window on the layout, without scrolling the whole layout, that gets even more complicated. Then you need a whole separate layer for that, then need to mask off the parts to not show...

Hopefully, this will get you started.

http://www.rieperts.com/games/forum/Scroll.capx
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Mon Feb 27, 2017 6:06 am

cool thanks!!!
B
13
S
2
Posts: 95
Reputation: 861


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 16 guests