Solved: Nighttime effect

Started by johanvepa, Sun 31/03/2013 12:34:40

Previous topic - Next topic

johanvepa

Ok, I'm trying again (I keep overloading my questions with useless info).

Question: How do I code in a function that tints the whole screen, or at least a region of the screen (so my status bar is unaffected) in a darker, bluish colour, indicating nighttime? It should be pretty simple, right?

I've tried using light level for a region (only the character is tinted dark, not everything else), and the SetAmbientTint function (stil only the character is tinted).




You can see my first postings further down, (but they're made before I tried hard enough by myself):

Quote
I'm doing an animation where cEgo is being manhandled out a door. That all works fine, with the simple tools I have available. Now, as an experiment, I'm trying to also tint the screen, so that it looks like nighttime when he is thrown out.

I use this in my code:

Code: AGS


function room_Load() //preparing animations setup before fadein
{
if (thrownout == true) //if bool says ego is being thrown out
  {
  SetAmbientTint(0, 0, 250, 30, 100);    //no red, no green, 250/255 blue, 30% blue saturation, half illumination. Look like nighttime?
  cEgo.LockView(25); //the real cEgo being invisible while animation is playing. View 25 is an empty frame.
  object[1].SetView(19, 1); //bouncer seen in doorway
  oThrownout.SetView(35, 0);  //object looking like cEgo grabbed by the neck, displayed in front of object looking like bouncer
  }
}

function room_AfterFadeIn() //now for the actual animations
{
if (thrownout == true) // if bool says ego is thrown out
  {
  Wait(10); //cEgo helpless in the arms of the bouncer
  cEgo.FaceLocation(85, 190, eNoBlock); //real cEgo looking downwards, preparation for when he is visible again
  object[8].Animate(0, 5, eOnce, eBlock);  //object looking like cEgo thrown and landing on street
  ShakeScreenBackground(5, 8, 20); //ouch, for 20 game rounds
  Wait(40); //lock game while screen is shaking for the 20 rounds, then continue lock further 20 rounds while bouncer is standing in the doorway, admiring his handiwork.
  object[1].SetView(19, 0, 0);  //image of closed door, no animation
  Wait(120); //the object looking like cEgo is lying around a bit longer
  object[8].Animate(2, 10, eOnce, eBlock);  //object looking like cEgo coming to his senses and slowly getting up
  oThrownout.SetView(35, 1); //object[8] looking like cEgo turned invisible
  cEgo.UnlockView(); //cEgo visible and ready again at the spot where object [8] becomes invisible
  }
}


All the animations works like they should. But there are two problems:

-The screen doesn't tint until all the animations have finished playing. This may have connection to the second problem:
-Only cEgo is tinted. Everything else is not.

I want to tint everything, the whole screen. So, according to the manual, I should use the SetAmbientTint. What am I doing wrong?

EDIT: Sorry for not reading thoroughly. The manual says only objects and characters are tinted.
However, I'm still puzzled as to why only the character is tinted. Objects are not. Can anyone explain why?

[quote/]

Khris

The easiest way to accomplish this is to use a screen-sized, non-clickable, semi-transparent GUI with its background color set to blue.

johanvepa

WORKS PERFECTLY! AND SO SIMPLE!

Thank you Khris!

Now onwards to the day/night cycle integers. I feel like I can totally do this!

SMF spam blocked by CleanTalk