Skip to content

Instantly share code, notes, and snippets.

@tlhunter
Created September 17, 2012 22:38
Show Gist options
  • Save tlhunter/3740219 to your computer and use it in GitHub Desktop.
Save tlhunter/3740219 to your computer and use it in GitHub Desktop.
Cobalt Calibur Game Loop
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