R
relic1882
Guest
I'm working on a clock system for my project that involves a day/night cycle. I'm using shaders to fade the screen from bright to dark and back using a global timer. At night, the lights come on and the paths are lit up the way I want while coming back to day the lights shut off. Everything is great on that aspect.
I'm using an alarm to hold the timer for 30 seconds in this code (although it will be changed to minutes) and by doing that is keeps my full day and full night as long as I want before transitioning back to the opposite.
My question is am I able to somehow keep an alarm timer continuous between different rooms, or do I have to make some more global variables and do this manually?
The alarm is simply releasing the trigger to continue the clock again.
pauseTimerTriggered = false;
Any thoughts? Thank you!
I'm using an alarm to hold the timer for 30 seconds in this code (although it will be changed to minutes) and by doing that is keeps my full day and full night as long as I want before transitioning back to the opposite.
My question is am I able to somehow keep an alarm timer continuous between different rooms, or do I have to make some more global variables and do this manually?
Code:
if (!pauseTimerTriggered)
{
global.timeOfDay += ((0.08 / room_speed) * global.clockDirection); //slow increase in time of day
if global.timeOfDay >= 0.94 //if time of day is dark,
{
pauseTimerTriggered = true; //trigger pausing the clock calculations for fading
alarm_set(0, room_speed * 30); //set alarm for XX seconds
global.timeOfDay = 0.94
global.clockDirection *= -1;
}
if global.timeOfDay <= .01 //same as above, but pause for full day setting
{
pauseTimerTriggered = true;
alarm_set(0, room_speed * 30);
global.timeOfDay = 0.01
global.clockDirection *= -1;
}
}
pauseTimerTriggered = false;
Any thoughts? Thank you!