Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Game.prototype.stopLoop = function () {
- if (this.running) {
- console.log('cancel the game now');
- window.webkitCancelRequestAnimationFrame(this.animationID);
- this.running = false;
- }
- };
- Game.prototype.startLoop = function (arg) {
- console.log('starting');
- var parent = this;
- this.running = true;
- (function tick() {
- parent.update();
- if (parent.running) parent.animationID = webkitRequestAnimationFrame(tick);
- }());
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement