Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: frission on Thu 11/10/2007 02:33:52

Title: Turning off the lights [SOLVED]
Post by: frission on Thu 11/10/2007 02:33:52
What's the best way to have the lights in the room "turn off"? I can imagine doing it a few ways but all of them seem rather hacky to me. How would you do it? I'm not experienced with animated backgrounds but that struck me as one possibility (have a frame that was the same room but with the lights off and switch to it when the switch was hit). Any and all suggestions would be appreciated! :-)
Title: Re: Turning off the lights
Post by: theatrx on Thu 11/10/2007 06:02:57
There's a bunch of ways to do this.

1/  If the player character hits a hotspot or stands on a region... change rooms to a darkened version of the same room or

2/ You can tint the screen so there is very little light in the room
Title: Re: Turning off the lights
Post by: frission on Thu 11/10/2007 14:11:19
Quote from: theatrx on Thu 11/10/2007 06:02:57
There's a bunch of ways to do this.

1/  If the player character hits a hotspot or stands on a region... change rooms to a darkened version of the same room or

2/ You can tint the screen so there is very little light in the room

#2 seemed like something easier but I couldn't figure out how to tint things and make them darker. All of the color tinting functions seemed to make them lighter, from what I could tell. Any thoughts?
Title: Re: Turning off the lights
Post by: Khris on Thu 11/10/2007 16:00:40
You can use a semi-transparent GUI as big as the screen with a black background.
Title: Re: Turning off the lights
Post by: frission on Fri 12/10/2007 00:08:15
Quote from: KhrisMUC on Thu 11/10/2007 16:00:40
You can use a semi-transparent GUI as big as the screen with a black background.

Oooh... that's super clever and might just be exactly what I was looking for. Thanks.

UPDATE: I gave it a shot and this looks pretty good. Thanks for the suggestion.
Title: Re: Turning off the lights
Post by: Dualnames on Sat 13/10/2007 23:16:05
Well you could try to import the first background(light) then import the second(dark) to the animated frames. Then add to the first time enter room

Setbackgroundframe(0);

Then go to the room open the hotspot/object where when the player clicks the room will get dark and add the following lines

if (GetBackgroundFrame==0) {
Setbackgroundframe(1);
}
else {
SetBackgroundFrame(0);
}
Title: Re: Turning off the lights
Post by: Khris on Sun 14/10/2007 17:38:01
You can do "SetBackgroundFrame(1-GetBackgroundFrame());".

Using this method requires one to change the images of all objects, too.
Title: Re: Turning off the lights
Post by: Ashen on Tue 16/10/2007 12:30:41
So, frission, is this solved (in which case, please edit the title), or are you still taking suggestions? Not that I have one, I think the best ways have been suggested already. I'd probably go with the semi-transparent GUI, as I couldn't be bothered changing the graphics of, or tinting, everything on screen. However, if it's only one or two rooms, actually drawing 'dark' versions of everything would probably look better - you could do hightlight/shadow effects, instead of just making them 'the same but darker'.
Title: Re: Turning off the lights
Post by: frission on Wed 17/10/2007 00:19:06
Quote from: Ashen on Tue 16/10/2007 12:30:41
So, frission, is this solved (in which case, please edit the title), or are you still taking suggestions? Not that I have one, I think the best ways have been suggested already. I'd probably go with the semi-transparent GUI, as I couldn't be bothered changing the graphics of, or tinting, everything on screen. However, if it's only one or two rooms, actually drawing 'dark' versions of everything would probably look better - you could do hightlight/shadow effects, instead of just making them 'the same but darker'.

Oh, this is solved. Thanks for reminding me.

Basically the two best options are the GUI overlay, which works fine in some cases, and maybe switching animated backgrounds, if the scene requires something more than that. Either way both of those options work great, and for a quicky-"make them turn on the lights before seeing the grisley scene" the GUI method works fine (one could imagine combining it with a few other tricks too if you want certainly things to be genuinely not visible until they turn on the lights).