Any suggestions on creating inertial scrolling for my game world?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vspin

I want my entire map in my 2D game world to be able to be scrolled with inertial scrolling. Any suggestions to accomplish this?

:bust_in_silhouette: Reply From: Bartosz
  1. Start with simple dragging for scroll effect e.g. map is scrolled only when you touch screen or are pressing mouse button

  2. modify your script to instead of actual dragging gave your map a speed that depends on how far user was trying to drag (map should run out from the screen)

  3. add friction to your map movement e.g. in each frame decrease its speed

  4. you’ve got yourself inertial scroll