changing room BG without changing room

Started by madradubhcroga, Tue 01/05/2012 06:02:00

Previous topic - Next topic

madradubhcroga

Hi.

Context of Problem:

Our hero enters a dimly lit room.  He goes over to the window, and throws open the curtains.
Now the room is brightly lit.

Problem:
How to change the room BG without moving everything to another room?
If it's not possible then how does one stop 'picked up' items from being duplicated in the new room?


Best Regards

MDC


(I bet this has been asked many times, but the search button is telling me "Your search query did not return any matches" for everything.  Maybe a problem with the forum upgrade.)

steptoe

#1
Hi

It depends on the effect you are after.

one way is to use 2 backgrounds for the same Room: 1 unlit and 1 lit.

Obviously you need to have 2 Backgrounds in which 1 is dim and one has light. You only need 1 Room for this.

Simply Import a new Background so you have 2 Backgrounds.

Main Background frame= 0, New Import Background=frame 1

On Room load you would use

Code: ags

function room_Load()
{
SetBackgroundFrame(0); // This is the unlit Room Background frame 0 and is the Main Background.
}


Then when you open the curtains (Interact with cutains and I have called them ocurtains you then go to Background frame 1.)

Code: ags

function ocurtains_Interact()
{
SetBackgroundFrame(1); // This is the lit Room Background frame 1 that is the new imported Background.
}


To go  back to Main Background frame simply:
Code: ags

SetBackgroundFrame(0);


This way you keep all your Objects in place.

Checkout 'SetBackgroundFrame' in the AGS manual.

Also, look at 'Regions' regarding lighting your character so he is darker in the dim room and lighter in the lit room.

Hope this helps you



madradubhcroga


SMF spam blocked by CleanTalk