No transparency in custom backgrounds

Need help with any SMBX game-related issues? Ask your questions here.

Moderator: Userbase Moderators

Alancron
Goomba
Goomba
Posts: 1
Joined: Sat Aug 18, 2018 5:07 pm

No transparency in custom backgrounds

Postby Alancron » Sat Aug 18, 2018 5:52 pm

Hi, i've been dealing with a problem in smbx2's editor: I made a custom graphic in background-23, and it looks fine on the editor, but when i test the level it disappears.

Image

Image

Thanks in advance. :mrgreen:

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9890
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: No transparency in custom backgrounds

Postby Emral » Sat Aug 18, 2018 6:21 pm

What's actually happening is that only the transparent area in the top left corner is being drawn.
As of Beta 3, BGOs don't automatically resize.
I wrote some code which should take care of that though:

Code: Select all

local replacedBGOs = {1,2,3,4,5,6,7,21,22,27,28,29,31,32,37,94,97,99,101,102,108,109,110,111,112,113,114,117,119,121,122,123,124,131,132,133,147,150,151,152,153}

local bgoImg = {}

for k,v in ipairs(replacedBGOs) do
	bgoImg[v] = Graphics.loadImage("background-"..v..".png")
end

local cam = Camera.get()[1]

function onDraw()
	do
		local cX = cam.x
		local cY = cam.y
		for k,v in ipairs(BGO.getIntersecting(cX - 200, cY - 100, cX + 1000, cY + 800)) do
			if bgoImg[v.id] then
				Graphics.drawImageToSceneWP(bgoImg[v.id], v.x, v.y, -75)
			end
		end
	end
end
https://hastebin.com/iboyuzubik.bash
Put this into a file called lunadll.lua inside your level folder (folder where your custom graphics are). Then all you have to do is change the IDs in the replacedBGOs list. You can take all of them out for a start, I only left them in as an example.


Return to “Help and Support”

Who is online

Users browsing this forum: No registered users and 5 guests

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari