Account for offset when using Scroll to on parallax layer

0 favourites
  • 3 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • What's a good way of accounting for the the offset introduced to "Scroll to" when scrolling to an object on a layer with parallax not set to 100,100?

    Example File of the problem. ... VRIcnlQdVU

    Arrow keys move sprite.

    1 toggles which layer the sprite is on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That is a weird gimmick. Doing this, i learned some more about parallax. ... .capx?dl=0

    Question is, and please do tell me, how/in what logic you are gonna use this ?

  • I fiddled around more after posting and came to a solution that seemed to work. Adding the canvas offset to the scroll to

    Scroll to
    X: Sprite.X+CanvastolayerX("normal",Sprite.X,Sprite.Y)-CanvasToLayerX(Sprite.LayerName,Sprite.X,Sprite.Y)
    Y: Sprite.Y+CanvastolayerY("normal",Sprite.X,Sprite.Y)-CanvasToLayerY(Sprite.LayerName,Sprite.X,Sprite.Y)
    Updated example file
    [url=] ... VdPMFZqVU0[/url]
    You're example works really well also.  I can't tell but I think yours maybe smoother and I don't know why.  I played with adding a lerp to the scroll to, and that smoothed it out some. 
    Now I'm trying to figure out the offset if I throw layerscale into the mix, no luck so far. 
    As to why I'm figuring it out.  No reason really I was playing with Parallax and layer scale and wanted to better understand them.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)