I am currently trying out a vertical infinite scrolling functionality. While auto-scrolling can be easily implemented by setting the Y position as
Self.Y - ScrollSpeed * dt
However, What I am trying to achieve is the the backgrounds would scroll infinitely but only when the player is moving vertically.
This is my layout:
There are three backgrounds: Red, Green and Blue. So whenever a player moves upward the backgrounds should repeat infinitely in sequence Red, Green, Blue and when the player is moving downward the backgrounds should repeat infinitely in sequence Blue, Green, Red.
How exactly to achieve functionality?