How do I make background stuff move up and down like the clouds in the Mario Challenge hub?

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
User avatar
Chilly14
Rex
Rex
Posts: 99
Joined: Thu Jul 18, 2019 10:28 pm
Current Project: Lots
Chat Username: Chilly Bean BAM!

How do I make background stuff move up and down like the clouds in the Mario Challenge hub?

Postby Chilly14 » Thu Jan 02, 2020 12:16 pm

If you don't know what I mean, take a look:
Image
See those clouds the ship is above? I want my background elements to move up and down the exact same way those clouds do.
Image
For the love of god, please use an adblocker when using MediaFire to download my stuff.
My stuff:
Spoiler: show
Image
Image
I support:
Spoiler: show
Image

User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7801
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: How do I make background stuff move up and down like the clouds in the Mario Challenge hub?

Postby Enjl » Thu Jan 02, 2020 1:00 pm

around line 304 in luna.lua of the mario challenge hub level
ImageImageImageImage
ImageImageImageImageImageImage

User avatar
Chilly14
Rex
Rex
Posts: 99
Joined: Thu Jul 18, 2019 10:28 pm
Current Project: Lots
Chat Username: Chilly Bean BAM!

Re: How do I make background stuff move up and down like the clouds in the Mario Challenge hub?

Postby Chilly14 » Thu Jan 02, 2020 1:19 pm

This happens:
Image
Code:

Code: Select all

local paralx = API.load("paralx2")

local fade = 1

Block.config[751].ceilingslope = 1
Block.config[752].ceilingslope = -1
Block.config[755].floorslope = -1
Block.config[756].floorslope = 1

function onTick()
	fade = fade - 0.01

	for k,v in ipairs(bgObj:get()) do
		if(v.name:match("^clouds%d+$")) then
			v.speedY = 0.8*math.sin(lunatime.tick()*0.02*k);
		end
	end
end

function onDraw()
	Graphics.drawScreen{color = Color.black .. fade, priority = 5}
end
Image
For the love of god, please use an adblocker when using MediaFire to download my stuff.
My stuff:
Spoiler: show
Image
Image
I support:
Spoiler: show
Image

User avatar
Enjl
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 7801
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Orphion Egamalenitar Osmos IV, Esq.

Re: How do I make background stuff move up and down like the clouds in the Mario Challenge hub?

Postby Enjl » Thu Jan 02, 2020 1:35 pm

You didn't copy the piece of code where the variable is initialized, so of course it's nil.
bgObj is probably initialized in an onLoadSection event and refers to the parallaxing background of the section.
ImageImageImageImage
ImageImageImageImageImageImage


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 2 guests