How do I scroll at opposite direction of drag?

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello,

    Trying for top down view sniper game.

    I have my scope center of layout with drag n drop behavior.

    I have also a large map and i want when dragging the scope the layout scroll to the opposite side of dragging.

    Right now if i drag my scope left , the layout scroll right.

    Scope is Dragging->scroll to position Scope.x / Scope.Y

    I want when i drag my scope left , the layout scroll left.

    Also is there any way to reduce the speed of scroll?

    I try to center my scope to the layout and instead of drag the scope i pin all the object to a sprite and drag the sprite, it works good but there is another problem, because all the targets are pin to this sprite the move to behavior of the targets are not work because are pined.

  • This will scroll in the opposite direction at 0.6 speed

  • Actually, there is an easier method with just one action:

    On every tick
     Scroll to 
     X: (scrollx + cos(Touch.AngleAt(0))*Touch.SpeedAt(0)*dt * 0.6)
     Y: (scrolly + sin(Touch.AngleAt(0))*Touch.SpeedAt(0)*dt * 0.6)
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks dop2000 second choise is better.

    Thank you very much.

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