Hey what would be the best way to do this? I'm gonna have a day and night cycle in my game and when it's night, objects should be tinted blue and when it's daytime i remove the tint. I know how to do that of course but when the day/night timer has expired and the character is in the room that will have day/night changes, do I have to put something like this in every room? (just doing this from the top off my head now so the actual code might contain errors. It's just for giving you an idea) beacause it will look weird when the background frame changes and the objects don't. They will change before fade in though if the variable "night" is either 0 or 1...Hope you know what I mean :D
function room_RepExec()
{
if (IsTimerExpired(1 && day==0)){
SetBackgroundFrame(1);
day=1;
object[0].Tint(0, 0, 250, 65, 100);
object[4].Tint(0, 0, 250, 65, 100);
object[5].Tint(0, 0, 250, 65, 100);
SetTimer(1,2000);
}
else if (IsTimerExpired(1 && day==1)){
SetBackgroundFrame(0);
day=0;
object[0].RemoveTint();
object[4].RemoveTint();
object[5].RemoveTint();
SetTimer(1,2000);
}
}
I'd put the code in the global repeaedly_execute() function, looking up Room.ObjectCount in order to loop through all the objects present. If you don't want all objects to be affected, you could potentially use a custom property to set a flag for objects you don't want tinted.
As a general comment, timers are quite limiting for a day-night cycle (for example, your code only supports an instant, abrupt transition between day and night). Might I recommend my module (http://www.adventuregamestudio.co.uk/forums/index.php?topic=49791.0)?
Ah ok I'll look into that! Actually it is not so abrupt. the character first say "Night is coming" or "Day has arrived" and I use fadeout and fade in as well but I get your point. I have already started making seperate bg's for day and night...and they have different lighting and stuff so I don't know if your module would do me any good? (awesome work by you though)
I've had good use of a tinted full screen non-clickable GUI.
SetAmbientTint() is probably what you are looking for, it will tint all the objects and characters currently on the screen.
If you want to exclude specific objects or characters from this behavior, you can use Character.Tint() and/or Object.Tint() with a saturation of 0, which will override the ambient tint with a blank tint.
Thanks :-D