Page 1 of 1

[SOLVED] Any way to use Lua to control Parallax Background parts?

Posted: Thu Jun 25, 2020 5:58 pm
by dragon3025
I have a cloud layer with "repeatX = true", and I'd like to give it a random x starting position. Is there a way to manipulate Parallax background settings with Lua?

If not, is there a way to use "Graphics.drawImageWP(img, x, y, priority)" to draw images behind some Parallax background layers and in front of others. It seems all "depths" in a Parallax background, gets merged into priority -100.0 and the back of the Parallax background fills with black instead of being transparent when I don't use a fill-color.

Re: Any way to use Lua to control Parallax Background parts?

Posted: Thu Jun 25, 2020 8:03 pm
by Hoeloe
You can set the priority of specific layers in parallax backgrounds, which affects draw priority but not their parallax depth.

You can get layers from the background by using the Section(index).background:get(name) function, which will return a Lua object. From there you can set pretty much any of the settings at runtime that you can in the .txt files, including changing the x and y.

Re: Any way to use Lua to control Parallax Background parts?

Posted: Thu Jun 25, 2020 8:55 pm
by dragon3025
Hoeloe wrote:
Thu Jun 25, 2020 8:03 pm
You can set the priority of specific layers in parallax backgrounds, which affects draw priority but not their parallax depth.

You can get layers from the background by using the Section(index).background:get(name) function, which will return a Lua object. From there you can set pretty much any of the settings at runtime that you can in the .txt files, including changing the x and y.
Thanks, I feel like I have a lot more control over the parallaxes now.