This is for background images, not colors.
In the room editor:
Create two backgrounds for a room. One in slot 0 and one in slot 1. Set both to NOT be visible when room starts.
Next create an object to draw backgrounds. Call it obj_background for example. This is all that the object will do, and there will only be one in the room. In it's create event add a variable bg_index. This variable should have the value 0 or 1 or possibly 2 or 3 if you add more background to a room. You will use it to draw one of the backgrounds.
Create event:
bg_index = 0;
In the Draw event draw the background. This will be at the top left corner of the room unless you change the x,y for some reason.
Draw event:
draw_background( background_index[bg_index] , 0 , 0 );
You could do:
draw_background( background_index[0] , 0 , 0 );
but that would allways draw background 0. With variable bg_index, you can use the same line of code
and still flip through different backgrounds.
Now when you want to change backgrounds, simply change bg_index to a different number. If you have only two backgrounds just doing this will flip between them:
if ( bg_index == 0 )
{
bg_index = 1;
}
else
{
bg_index = 0;
}
If you put that in a keyboard event, the background will change everytime you press a key. You will probably not want to use key presses however, but some game event.
A problem you might run into is accessing the variable bg_index from a different object. You could make bg_index a global variable, but if you only have one instance of object obj_background in the room, you can use it's name to access it's variables.
For example, if you're changing backgrounds from some other object, you could do this:
if ( player_health <= 0 )
{
obj_background.bg_index = 3;
// do other things
}
This would cause obj_background to draw the background in slot 3 if player's health dropped to 0 or below. Normally you have to use instance_id.variable_name = value; in order to change variables in other objects, BUT if there is one and only one such instance present, then using it's name will work. This is because when you use an object name in such a way, you're telling GameMaker to access all instances of this object and change the value of a variable, or do something else to all of them. But there is only one obj_background, so you won't accidentaly modify several instances.
Definitely read up on the functions in the manual. It's a fountain of information. Middle-click on a function in the code editor and the manual will open with a usefull description of the function you clicked on. Very nice.