Account for offset when using Scroll to on parallax layer

  • 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.

    https://drive.google.com/open?id=0B0Ci6 ... VRIcnlQdVU

    Arrow keys move sprite.

    1 toggles which layer the sprite is on.

  • That is a weird gimmick. Doing this, i learned some more about parallax.

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

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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)
    [/code:3nsk4mg5]
    
    Updated example file
    [url=https://drive.google.com/open?id=0B0Ci6qxowiQWUUU1SVdPMFZqVU0]https://drive.google.com/open?id=0B0Ci6 ... 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)