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:
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!
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!