00:00
00:00
Newgrounds Background Image Theme

Someone gifted MetalSlayer69 supporter status!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Night/Day Timer? 2006-08-07 16:44:00


What I want to do is set up a timer so every 10 minutes it will change from night or day. Could anyone help me do thatso it would be like.

if(timer == 10minpast && day == false){
_root.day = true;
}

Response to Night/Day Timer? 2006-08-07 17:25:37


Use a setInterval. Since it goes by miliseconds the interval would have to be pretty friggin' huge though.

var day:Boolean = true;
function daySwitch() {
if(day) {
//commands to make it night;
} else {
//commands to make it day;
}
day = !day;
}

setInterval(daySwitch,1000*60*10);

The parameters in the setInterval statement may be in the wrong order, but that should make it switch from night to day and vice versa every ten minutes.

Note: Doesn't account for game pausing.