Having Trouble With 2 Independent Backgrounds
Having Trouble With 2 Independent Backgrounds
Ps. If you are unsure of what I mean by this background, the game 'Guacamelee' is a perfect example.
Re: Having Trouble With 2 Independent Backgrounds
This type of background scrolling is called parallax scrolling.
Usually you implement that by having a fixed ration of the two backgrounds scrolling speed, say 2.
So somewhere you store how far the background has moved (in pixels) for the second background, simply divide this distance by the above factor (2) and use this distance as displacement for the second background (the one farther away).
So if for example the front background moved 100 pixels, move the other one only 50 pixels.
Usually you implement that by having a fixed ration of the two backgrounds scrolling speed, say 2.
So somewhere you store how far the background has moved (in pixels) for the second background, simply divide this distance by the above factor (2) and use this distance as displacement for the second background (the one farther away).
So if for example the front background moved 100 pixels, move the other one only 50 pixels.
Check out my blog on gamedev
Who is online
Users browsing this forum: No registered users and 5 guests