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

Post here for help and support regarding LunaLua and SMBX2's libraries and features.

Moderator: Userbase Moderators

dragon3025
Bot
Bot
Posts: 55
Joined: Fri Aug 07, 2015 5:02 pm

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

Postby dragon3025 » Thu Jun 25, 2020 5:58 pm

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.
Last edited by dragon3025 on Thu Jun 25, 2020 8:55 pm, edited 1 time in total.

Hoeloe
Phanto
Phanto
Posts: 1465
Joined: Sat Oct 03, 2015 6:18 pm
Flair: The Codehaus Girl
Pronouns: she/her

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

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

dragon3025
Bot
Bot
Posts: 55
Joined: Fri Aug 07, 2015 5:02 pm

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

Postby dragon3025 » Thu Jun 25, 2020 8:55 pm

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.


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 9 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari