Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: duanne_boy on Sun 30/09/2012 21:54:09

Title: strobe lighting
Post by: duanne_boy on Sun 30/09/2012 21:54:09
is there away to control the gamma
so it flickers the screen light a strobe light.

Title: Re: strobe lighting
Post by: Slasher on Mon 01/10/2012 05:57:36
You could import a second background or just have it set off by a region/hotspot for example and set the gamma property so that when the background animates or region walked on or hotspot interacted, the gamma changes and the effect happens.

Gamma property:
Gets/sets the current screen Gamma level. This is 100 by default, and you can set it anywhere from 0 (pitch black) to 200 (double normal brightness).

Check out Gamma property in the AGS help file.

You can stop it by setting the SetBackgroundFrame property if in the same room or returning it to normal if just one background.

This is one possible way.


Title: Re: strobe lighting
Post by: Khris on Mon 01/10/2012 10:12:11
Note that changing Gamma only works if the game is run fullscreen.
You shouldn't use Gamma to make the screen flash anyway; it's not supposed to be used like that and could even ruin stuff (eyes, at least).
Title: Re: strobe lighting
Post by: Slasher on Mon 01/10/2012 10:47:55
I agree with Khris, strobe lighting affects certain people, as well as annoying normal eyes, so a warning MUST be given before the game starts that it contains some strobe lighting effects.

Use 2 backgrounds for the effect. One background (main) is normal and the other background (import new background) dark so it animates like a strobe. No need to use gamma settings this way.

The room will 'strobe' until you set background frame to 0.

Apart from that....
Title: Re: strobe lighting
Post by: Crimson Wizard on Mon 01/10/2012 12:18:23
Can't a Tint be used here?
http://www.adventuregamestudio.co.uk/wiki/?title=Region_functions_and_properties#Region.Tint

Also, I think it is possible to use Dynamic Sprites with alpha channel.
Title: Re: strobe lighting
Post by: duanne_boy on Tue 02/10/2012 14:09:37
hi all thanks for the info.
yes using the gamma is a bad idea.
so im trying the room animation with 3 back grounds 0 with all open doors and sprites 1 with a solid pic with closed doors and 3 which is black.
i tryed it with just 0 and 1 as the back background.
but when i ran it the sprites was showing up.
so can you animate between 1 and 2 then set it to 0 after?


im havin trouble still tho. as i cant find in the manual info about animating room frames.


Title: Re: strobe lighting
Post by: Slasher on Tue 02/10/2012 16:05:53
I've had the same problem with objects showing on a black background that I have solved. Not quite the same scenario but nonetheless.

You could have the objects made invisible if a certain background frame is showing.

I have not tried this but I assume it should work.

Code (AGS) Select

function room_RepExec()
{
if (background.Frame==0)
{
odoor.Visible=false;
owindow.Visible=false;   // simply amend to your objects.
}
else
{
odoor.Visible=true;
owindow.Visible=true;   // simply amend to your objects.
}
}



Adjust to suit.

Come on guys, where are you  (roll)

Title: Re: strobe lighting
Post by: duanne_boy on Tue 02/10/2012 17:00:56
the only problem with that is if i make the sprite none visible.
the room will look like it as open doors.
that is why i made a background with it closed and one with it open and one black.

they only other way i can think of solving this problem is making a new room with the closed door pic and the black background.
have them animate and then after the animation as run go to the room where the game starts





Title: Re: strobe lighting
Post by: Crimson Wizard on Tue 02/10/2012 17:31:01
Hmm, do I understand correct that you want to make verything pitch black for a moment?
Have you considered using FadeIn/FadeOut functions:
http://www.adventuregamestudio.co.uk/wiki/?title=Screen_functions#FadeIn

May they fit your needs?

E: Oh, wait. You mean there's nothing but doors visible?
Then they probably won't be that useful....

What about a big black object in foreground with "holes" for doors?
Title: Re: strobe lighting
Post by: duanne_boy on Tue 02/10/2012 17:44:42
what im trying to do is a light effect.
so at game start the room flashes, flickers a couple a times like a fluorescent light is being turned on.

or even when a light switch is pressed on a dark room.

ive my main background with a open door.
and a object door which i make invisible when its open.

if i run the room animation with the black background the door object is visible and is not black.
if i was to make it none visible it not show the door sprite and i would get the effect.
but will then show the main background image with the door open.
which needs to be closed.
Title: Re: strobe lighting
Post by: Crimson Wizard on Tue 02/10/2012 20:38:26
Quote from: duanne_boy on Tue 02/10/2012 17:44:42
what im trying to do is a light effect.
so at game start the room flashes, flickers a couple a times like a fluorescent light is being turned on.

Try to put this in your "Room After Fade In" function:
Code (ags) Select

FadeOut(64);
Wait(10);
FadeIn(64);
Wait(10);
FadeOut(64);
Wait(10);
FadeIn(64);

Will that do similar thing to what you want?
Title: Re: strobe lighting
Post by: HandsFree on Tue 02/10/2012 21:02:12
Quote from: duanne_boy on Tue 02/10/2012 17:44:42ive my main background with a open door.
and a object door which i make invisible when its open.
Isn't the solution then to make the background with closed doors and have objects for open doors?
Title: Re: strobe lighting
Post by: Khris on Tue 02/10/2012 21:48:56
If you use the built-in background animation, all frames are used.
You can do:
Code (ags) Select

  int delay = 3;
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
Title: Re: strobe lighting
Post by: duanne_boy on Tue 02/10/2012 23:37:03
thanks you all for the help heres the code i have now and works great :)

function room_AfterFadeIn()
{
RemoveWalkableArea(1);
AODoor.Visible = false;
int delay = 3;
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(2);
  Wait(delay);
  SetBackgroundFrame(1);
  Wait(delay);
  SetBackgroundFrame(0);
  AODoor.Visible = true;
}

Cheers