Created
September 17, 2012 22:38
-
-
Save tlhunter/3740219 to your computer and use it in GitHub Desktop.
Cobalt Calibur Game Loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var currentFrame = 0; | |
setInterval(function() { | |
currentFrame++; | |
if (currentFrame % 3 == 0) { | |
currentFrame = 0; | |
// redraw every 150 ms, but change animation every 450 ms | |
app.graphics.globalAnimationFrame = !app.graphics.globalAnimationFrame; | |
app.player.killIfNpcNearby(); | |
} | |
app.environment.map.render(currentFrame === 0); | |
}, 150); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment