Page 1 of 1

[Solved] Parallax Background Piece is Flickering

Posted: Sun Jun 21, 2020 12:21 am
by dragon3025
I've created a Parallax Background using this code:
Spoiler: show

Code: Select all

[background2]
name = "Toad Town"
fill-color = black

[Clouds]
img = "clouds.png"
repeatX = true
speedX = 0.05

[Mountains]
img = "mountains.png"
repeatX = true

[Shooting Star Summit]
img = "shooting star summit.png"
parallaxX = 0.05
alignY = BOTTOM
x = 320
y = 16

[Toad Town Houses]
img = "toad town houses.png"
parallaxX = 0.5
alignY = BOTTOM
After adding the [Toad Town Houses] segment, the Parallax piece from [Shooting Star Summit] started flickering (and sometimes appearing behind everything else): https://imgur.com/QocLMkB

Re: Parallax Background Piece is Flickering

Posted: Sun Jun 21, 2020 12:44 am
by Hoeloe
You're not setting the depth for any of these layers, so they're all trying to draw at the same depth. You should, in most cases, use the "depth" field instead of directly setting parallaxX or parallaxY, as it automatically computes those based on the given distance.

Re: Parallax Background Piece is Flickering

Posted: Sun Jun 21, 2020 11:56 am
by dragon3025
Hoeloe wrote:
Sun Jun 21, 2020 12:44 am
You're not setting the depth for any of these layers, so they're all trying to draw at the same depth. You should, in most cases, use the "depth" field instead of directly setting parallaxX or parallaxY, as it automatically computes those based on the given distance.
Thanks. I added depth and it's working fine now.

Re: [Solved] Parallax Background Piece is Flickering

Posted: Sun Jun 21, 2020 12:03 pm
by Hoeloe
I would suggest using depth instead of parallaxX. By using depth values you can adjust the speeds (with INFINITE meaning no scrolling), and it ensures things stay looking good without having strange differences in scroll speeds. In general, it's far easy to think about "how far away is this layer?" than to think about "what proportion of the camera scrolling speed should this layer have?". The depth field was designed to make adding background layers easier, so you don't have to manually adjust parallax scrolling speeds.