How to build vertical scrollbar for very high image?

From the Asset Store
Build Your Snowman
$4.75 USD
5% off
Create your own beautiful snowman in this fun game!
  • How to build vertical scrollbar for very high image?

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • cool thanks!!!

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