FreakSoftware
2002.10.06, 07:27 PM
Well, I figured out parallax scrolling on my own. I figured it couldn't be too hard, so I thought about it for a second, and played with it for a while and I figured it out.
Here's the two lines of code (per layer) that it requires:
LayerOffset = DeltaX * ((LayerWidth - ViewWidth)/(ForegroundLayerWidth-(ViewWidth*2))
DrawPicture LayerPicture, LayerOffset, 0
Where ViewWidth is the width of the animation area (i.e. if you wer e full screen, ViewWidth would be the screen width), and DeltaX is the number of pixels that you're scrolling.
One thing I did notice is that in my current example project, the Foreground scrolling rate isn't equal to 1, it's actually equal to 1.3 which is kind of odd. I know that it makes sense mathematically using the code above, but I wonder what I would need to change to get it equal to 1 instead. If you have any ideas on that, could you let me know?
One other question, where did the word Parallax come from? It obviously sounds like a combination of parallel axis, which kind of makes senses, but is that really where it came from?
Here's the two lines of code (per layer) that it requires:
LayerOffset = DeltaX * ((LayerWidth - ViewWidth)/(ForegroundLayerWidth-(ViewWidth*2))
DrawPicture LayerPicture, LayerOffset, 0
Where ViewWidth is the width of the animation area (i.e. if you wer e full screen, ViewWidth would be the screen width), and DeltaX is the number of pixels that you're scrolling.
One thing I did notice is that in my current example project, the Foreground scrolling rate isn't equal to 1, it's actually equal to 1.3 which is kind of odd. I know that it makes sense mathematically using the code above, but I wonder what I would need to change to get it equal to 1 instead. If you have any ideas on that, could you let me know?
One other question, where did the word Parallax come from? It obviously sounds like a combination of parallel axis, which kind of makes senses, but is that really where it came from?