Candle light and flickering characters. [SOLVED]

Started by RetroJay, Wed 17/07/2013 00:50:48

Previous topic - Next topic

RetroJay

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.

RetroJay


Scavenger

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

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.

RetroJay

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

RetroJay

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
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.

SMF spam blocked by CleanTalk