Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to limit a line scroll to a certain part of the world?
#2
Hi!
Cool effectyou did with the grass.
Solving the issue is easy. You just have to compensate for the y offset. For example, if you scroll the world 10 pixels positive -so the layer moves upwards from bottom to top-, you have to compensate by substracting the same amount of pixels to the raster effect lines:

Code:
void GrassLineScroll(int line)
{
       if (line == 0 - y_world) {
           TLN_SetLayerParallaxFactor(2, 0.50, 1.0);
       }
       if (line == 167 - y_world) {
           TLN_SetLayerParallaxFactor(2, 0.80, 1.0);
       }
       if (line == 180 - y_world) {
           TLN_SetLayerParallaxFactor(2, 0.90, 1.0);
       }
       if (line == 192 - y_world) {
           TLN_SetLayerParallaxFactor(2, 0.95, 1.0);
       }
   }

This works assuming that the raster lines in your code work when y_world = 0, if not, you have to include the value y_world has when it is "grounded".

Happy Christmas!
Reply


Messages In This Thread
RE: How to limit a line scroll to a certain part of the world? - by megamarc - 12-24-2021, 06:04 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)