Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: RetroJay on Wed 17/07/2013 00:50:48

Title: Candle light and flickering characters. [SOLVED]
Post by: RetroJay on Wed 17/07/2013 00:50:48
Hi All good peeps.

I am creating the second part of 'The Lost Prince Of Lorden' and wish to add more effects this time.

In one part of my game the character is in a room with flickering candle light.
The walls and floor flicker, as they should. I have used animating backgrounds for this.
Is there a way that I can make the Player character and other characters flicker too?

I was thinking maybe regions would have to be used.

Any help would be much appreciated.

Yours.
Jay.
Title: Re: Candle light and flickering characters.
Post by: RetroJay on Thu 18/07/2013 22:34:27
I guess not then. :(
Title: Re: Candle light and flickering characters.
Post by: Scavenger on Thu 18/07/2013 22:45:24
Yes, there is a way. I believe you can use region[ ].LightLevel to set the light level of the characters on the region. Put this in your room script.

Code (AGS) Select

function repeatedly_execute_always ()
{
    if (GetBackgroundFrame () == 0) //Check the manual to see if this is the right function.
    {
        region[CANDLE_REGION].LightLevel = 50;
        region[OTHER_REGION].LightLevel = 20;
        //...
    }
    else if (GetBackgroundFrame () == 1) //Check the manual to see if this is the right function.
    {
        region[CANDLE_REGION].LightLevel = 70;
        region[OTHER_REGION].LightLevel = 50;
        //...
    }
    else if (GetBackgroundFrame () == 2) //Check the manual to see if this is the right function.
    {
        //... and so on.
    }
}


Obviously, you have to change the _REGION text to the numbers of your regions, but this should work.
Title: Re: Candle light and flickering characters.
Post by: RetroJay on Thu 18/07/2013 23:04:51
Hi Scavenger.

Thank you for your reply.
I will try the script you have given me and will let you know how things go.

Many Thanks.
Jay
Title: Re: Candle light and flickering characters.
Post by: RetroJay on Fri 19/07/2013 05:01:38
Hi Scavenger.

The script you gave me works like a charm. :-D

The only thing I had to do was to use a minus on the light levels. (Didn't know you could even do that until I tried.)
So I have...
Code (AGS) Select
function repeatedly_execute_always () {
 
  if (GetBackgroundFrame () == 0) { //This is the right function... Cos it works.
  region[2].LightLevel = -30;
  }
  else if (GetBackgroundFrame () == 1) { //This is the right function... Cos it works.           
  region[2].LightLevel = -40;
  }
  else if (GetBackgroundFrame () == 2) { //This is the right function... Cos it works.
  region[2].LightLevel = -15;
  }
    else if (GetBackgroundFrame () == 3) { //This is the right function... Cos it works.
  region[2].LightLevel = -30;
  } 
  else if (GetBackgroundFrame () == 4) { //This is the right function... Cos it works.
  region[2].LightLevel = -20;
  }
}


All of my other regions I just left as is because it is fairly dark on those and candle light wouldn't reach the characters.

It looks pretty damn good, even if I do say so myself. ;)

Thank you for your help.
It is much appreciated.

Yours.
Jay.