Difference between revisions of "Sic/frame4.as"
From Organic Design wiki
(legacy) |
m |
||
Line 1: | Line 1: | ||
{{legacy}} | {{legacy}} | ||
− | < | + | <source lang="js"> |
// | // | ||
// Liscenced under LGPL: www.gnu.org/copyleft/lesser.html | // Liscenced under LGPL: www.gnu.org/copyleft/lesser.html | ||
Line 36: | Line 36: | ||
} | } | ||
else demo._visible = game._visible = environment._visible = false; | else demo._visible = game._visible = environment._visible = false; | ||
− | </ | + | </source> |
[[Category:ActionScript]] | [[Category:ActionScript]] |
Latest revision as of 03:09, 23 April 2020
//
// Liscenced under LGPL: www.gnu.org/copyleft/lesser.html
//
// Nad - 2003 - SIC-Games
//
// Frame4: PER-FRAME
now = new Date();
time = now.getTime();
processOutgoingEvents(); // Propagate any accumulated local events
processIncomingEvents(); // Execute events needing instantiation this frame
// Periodically attempt connection
// - first connection attempt is after delay so that peers are all connected
if (!network.connected && ++network.ctr%1000 == 999) network.connect('127.0.0.1', network.port);
if (shell.state != 2) {
// Execute frame() for environment
environment._visible = true;
environment.frame();
// Execute frame() for active spaces - which in turn calls frame() of objects it contains
for (var i = 0; i < allSpaces.length; i++)
if (allSpaces[i].active) allSpaces[i].frame();
// Demo mode (screensaver)
if ((environment.phase < 10)&&(time - environment.lastActivity) > environment.timeout) {
environment.time = time;
environment.phase = 10;
}
}
else demo._visible = game._visible = environment._visible = false;