[Solved] Parallax Background Piece is Flickering

Need help with any SMBX game-related issues? Ask your questions here.
User avatar
dragon3025
Spiny
Spiny
Posts: 48
Joined: Fri Aug 07, 2015 5:02 pm

[Solved] Parallax Background Piece is Flickering

Postby dragon3025 » Sun Jun 21, 2020 12:21 am

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
Last edited by dragon3025 on Sun Jun 21, 2020 11:56 am, edited 1 time in total.

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: Parallax Background Piece is Flickering

Postby Hoeloe » 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.

User avatar
dragon3025
Spiny
Spiny
Posts: 48
Joined: Fri Aug 07, 2015 5:02 pm

Re: Parallax Background Piece is Flickering

Postby dragon3025 » Sun Jun 21, 2020 11:56 am

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.

User avatar
Hoeloe
Kamikaze Koopa
Kamikaze Koopa
Posts: 1236
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Current Project: A2XT Episode 2

Re: [Solved] Parallax Background Piece is Flickering

Postby Hoeloe » Sun Jun 21, 2020 12:03 pm

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.


Return to “Help and Support”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 16 guests