Jump to content
  • Advertisement
  • entries
    48
  • comments
    57
  • views
    43535

Parallax Scrolling

Sign in to follow this  
r1ckparker

814 views

I implemented some horizontal scrolling and found that it was not smooth and juddered about, and I realised my timings were out.  I have a viewport on the level and this scrolls to the right.  

The timing of these were not in sync, so I had to re-do the timing.  I don't want to scroll the mid and background every frame, and I can't scroll 1/2 a pixel!   So the solution was to set up a counter.  When counter is 1, scroll the foreground by 1 pixel.  When the counter is 3, scroll the foreground again and also the mid-ground.  When the counter is 5, scroll the foreground, mid ground and background.  Then reset the counter back to 0.  Seems to work well!  Scrolling is nice and smooth.  I also had another issue with 'shimmering' where the pixels did not appear to be smooth as the screen scrolled.  I found this was due to my view port which was scaling the view in my play area.  Fixing this gives me a nice 1:1 pixel ratio and super-smooth parallax scrolling!

There's also a little up-and down scrolling, to make the levels appear a little bigger.  If you are above a certain pixel line, the view scrolls up and if you are below it scrolls down.  It's only a little touch and you probably wouldn't even notice it but it makes the playing area slightly bigger than the view port but not enough that enemies and bullets will be hidden of the top and bottom of the screen.

 


Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!