• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Creating a scrolling loopin train type bg

Hey there, I have a problem with my Looping BG, it's supposed to scroll at a certain speed to the left, however
when the xview moves left the bg scrolls faster, and when xview moves right the bg scrolls slower. How do i make an infinite looping BG but keep the speed persistent, meaning now slowing down or speeding up, but to give the illusion that the bgs will always be moving at the same pace?
 

trg601

Member
For this you could either move the background x with the difference in xview per step or just manually scroll the background and set it relative to xview.
The first way you would need a "previous xview" variable to keep track of how much xview has changed during the step. The code could look something like this:
Code:
background_x[0] += (view_xview[0] - view_xview_previous);
view_xview_previous = view_xview[0];
The second way you would need another "background x" variable that you manually add on to in order to scroll the background and set it like so:
Code:
back_x -= 1; //Insert hspeed here
background_x[0] = view_xview[0] - back_x;
The second way works by anchoring the background origin to the view x.
 
Top