• 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 Background parallax scroll only when player moves?

A

Agletsio

Guest
Hi there,

I'm busy working on side-scroller.

I'm trying to make my background parallax scroll when I'm moving right or left.

At the moment I am able to do parallax scrolling with the background function in room editor.
And I am able to to make viewport follow my Player.

But my problem is I can't get them to work together. With the built in background setting in room editor (Hor. speed, Vert. speed) you can only set a constant speed, without factoring in your player movement.

And when using the "viewport follow player" setting, the backgrounds scroll as a whole and not individually to create the parallax effect.

Ideally I would want my background to only parallax scroll when my player is moving. How would I approach this?

Would I need to use code in Player step event to achieve this?

Any help would be much appreciated!
 

jazzzar

Member
if the player is moving background_hspeed[0....7] or background_vspeed[0...7] equals whatever you want, else if the player is not moving, set the value of hspeed or vspeed of the background to 0?
 
A

Agletsio

Guest
if the player is moving background_hspeed[0....7] or background_vspeed[0...7] equals whatever you want, else if the player is not moving, set the value of hspeed or vspeed of the background to 0?
Thanks!

Was actually working on this approach then I realised that I was referring to the backgrounds in my resource window instead of the ones in room editor. For some reason your reply sparked that revelation so many thanks!
 

jazzzar

Member
Thanks!

Was actually working on this approach then I realised that I was referring to the backgrounds in my resource window instead of the ones in room editor. For some reason your reply sparked that revelation so many thanks!
my pleasure mate :) good luck
 
L

Lotias

Guest
Most people draw the backgrounds manually for a good parallax effect. Using the default room backgrounds tends to result in what appears to be slight lag on the parallax.
 
Top