[Tutorial] How to add new background colors

Mods, guides how to use and install mods go right in here.
Post Reply
z0mb1
Posts: 16
Joined: 17 Mar 2012, 09:17

Post » 27 Mar 2012, 07:31

This guide is to add new single background colors to your drop-down list in the level editor. This will not enable more background images, but will allow you more monochromatic backgrounds to play with. This is my first tutorial, so please bear with me.

The first thing that you need to do is pull editor.lua and game.lua from the source file to your desktop, using 7zip or WinRAR.

Open editor.lua and look for the line that says...

Code: Select all

guielements["backgrounddropdown"] = guielement:new("dropdown", 17, 85, 6, changebackground, background, "blue", "black", "water")
Add whatever you want to call your new background color to the list. In this case I wanted a crimson background, so now the line looks like this...

Code: Select all

guielements["backgrounddropdown"] = guielement:new("dropdown", 17, 85, 6, changebackground, background, "blue", "black", "water", "crimson")
Save the altered editor.lua file to your desktop.

Next open game.lua. Look for the line that says...

Code: Select all

function game_load(suspended)
	scrollfactor = 0
	backgroundcolor = {}
	backgroundcolor[1] = {92, 148, 252}
	backgroundcolor[2] = {0, 0, 0}
	backgroundcolor[3] = {32, 56, 236}
	love.graphics.setBackgroundColor(backgroundcolor[1])
Add a new background color, using RGB color codes. You can find a list of codes at http://cloford.com/resources/colours/500col.htm. Be sure to number the next line properly. For crimson I made the code chunk look like this...

Code: Select all

function game_load(suspended)
	scrollfactor = 0
	backgroundcolor = {}
	backgroundcolor[1] = {92, 148, 252}
	backgroundcolor[2] = {0, 0, 0}
	backgroundcolor[3] = {32, 56, 236}
	backgroundcolor[4] = {220, 20, 60}
	love.graphics.setBackgroundColor(backgroundcolor[1])
Save the altered game.lua file to your desktop.

Go into the source file and rename game.lua to game.old and editor.lua to editor.old. Drag your new .lua files from the desktop into the source file. Close it out, then open Mari0. Now, in your Background Color options, you should see your new color.

Have fun!

User avatar
renhoek
Posts: 4545
Joined: 11 Feb 2012, 10:04

Post » 27 Mar 2012, 09:49

or you could just put a colour onto a background image and use that :\

z0mb1
Posts: 16
Joined: 17 Mar 2012, 09:17

Post » 27 Mar 2012, 10:00

Right. But there you're limited to only one image. Here, you can have as many colors as you want. For my modded game I have a background image of a starry night sky, but I also wanted Mario to swim through dirty sewer water and enter a boiler area with a red background to convey heat. I made a .png of the starry night sky and then used the above method for my red-hot background and slimy sewer water background. Just opening up more options here. Isn't that what modding is all about?

User avatar
renhoek
Posts: 4545
Joined: 11 Feb 2012, 10:04

Post » 27 Mar 2012, 10:11

not sure if you know but everyscreen can have a custom background,
it really doesn't need mods.

z0mb1
Posts: 16
Joined: 17 Mar 2012, 09:17

Post » 27 Mar 2012, 10:31

How? When I stick a background image in the mappack folder and then stick another in there, I see no option in the level editor to choose which of the two background images I have in there. Is it a file naming thing?

User avatar
renhoek
Posts: 4545
Joined: 11 Feb 2012, 10:04

Post » 27 Mar 2012, 11:05

do dis
Image

z0mb1
Posts: 16
Joined: 17 Mar 2012, 09:17

Post » 27 Mar 2012, 11:11

I'll give that a go. Thanks.

Post Reply