development     reviews     feed

Parallax Scrolling is Working!

One of my goals this week was to get parallax scrolling working, by importing TiledLib’s draw code into my Level class and adding some features. Now, any layer that I mark as a parallax layer can have a value assigned (right now 0.5 and 1.5 are the values I’m working with, and they just represent scroll speed as compared to the main level layer that the player traverses), and then the draw code will take care of the rest. Really easy stuff, actually, but it did take me a while to see exactly how I was going to add it. I exposed player position in the engine so that the level could draw itself accordingly… it’s definitely not the most elegant solution, but it got the job done for now and I’d like to keep pushing forward.