Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: components/neterror/resources/offline.js

Issue 2243293002: Reduce memory and CPU resources on offline interstitial while idle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 (function() { 4 (function() {
5 'use strict'; 5 'use strict';
6 /** 6 /**
7 * T-Rex runner. 7 * T-Rex runner.
8 * @param {string} outerContainerId Outer containing element id. 8 * @param {string} outerContainerId Outer containing element id.
9 * @param {Object} opt_config 9 * @param {Object} opt_config
10 * @constructor 10 * @constructor
(...skipping 25 matching lines...) Expand all
36 36
37 this.highestScore = 0; 37 this.highestScore = 0;
38 38
39 this.time = 0; 39 this.time = 0;
40 this.runningTime = 0; 40 this.runningTime = 0;
41 this.msPerFrame = 1000 / FPS; 41 this.msPerFrame = 1000 / FPS;
42 this.currentSpeed = this.config.SPEED; 42 this.currentSpeed = this.config.SPEED;
43 43
44 this.obstacles = []; 44 this.obstacles = [];
45 45
46 this.started = false; 46 this.activated = false; // Whether the easter egg has been activated.
47 this.activated = false; 47 this.playing = false; // Whether the game is currently in play state.
mmenke 2016/08/23 14:38:45 Thanks! This makes the code much easier to follow
48 this.crashed = false; 48 this.crashed = false;
49 this.paused = false; 49 this.paused = false;
50 this.inverted = false; 50 this.inverted = false;
51 this.invertTimer = 0; 51 this.invertTimer = 0;
52 this.resizeTimerId_ = null; 52 this.resizeTimerId_ = null;
53 53
54 this.playCount = 0; 54 this.playCount = 0;
55 55
56 // Sound FX. 56 // Sound FX.
57 this.audioBuffer = null; 57 this.audioBuffer = null;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 BG_CLOUD_SPEED: 0.2, 107 BG_CLOUD_SPEED: 0.2,
108 BOTTOM_PAD: 10, 108 BOTTOM_PAD: 10,
109 CLEAR_TIME: 3000, 109 CLEAR_TIME: 3000,
110 CLOUD_FREQUENCY: 0.5, 110 CLOUD_FREQUENCY: 0.5,
111 GAMEOVER_CLEAR_TIME: 750, 111 GAMEOVER_CLEAR_TIME: 750,
112 GAP_COEFFICIENT: 0.6, 112 GAP_COEFFICIENT: 0.6,
113 GRAVITY: 0.6, 113 GRAVITY: 0.6,
114 INITIAL_JUMP_VELOCITY: 12, 114 INITIAL_JUMP_VELOCITY: 12,
115 INVERT_FADE_DURATION: 12000, 115 INVERT_FADE_DURATION: 12000,
116 INVERT_DISTANCE: 700, 116 INVERT_DISTANCE: 700,
117 MAX_BLINK_COUNT: 3,
117 MAX_CLOUDS: 6, 118 MAX_CLOUDS: 6,
118 MAX_OBSTACLE_LENGTH: 3, 119 MAX_OBSTACLE_LENGTH: 3,
119 MAX_OBSTACLE_DUPLICATION: 2, 120 MAX_OBSTACLE_DUPLICATION: 2,
120 MAX_SPEED: 13, 121 MAX_SPEED: 13,
121 MIN_JUMP_HEIGHT: 35, 122 MIN_JUMP_HEIGHT: 35,
122 MOBILE_SPEED_COEFFICIENT: 1.2, 123 MOBILE_SPEED_COEFFICIENT: 1.2,
123 RESOURCE_TEMPLATE_ID: 'audio-resources', 124 RESOURCE_TEMPLATE_ID: 'audio-resources',
124 SPEED: 6, 125 SPEED: 6,
125 SPEED_DROP_COEFFICIENT: 3 126 SPEED_DROP_COEFFICIENT: 3
126 }; 127 };
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 this.canvas.height = this.dimensions.HEIGHT; 427 this.canvas.height = this.dimensions.HEIGHT;
427 428
428 Runner.updateCanvasScaling(this.canvas); 429 Runner.updateCanvasScaling(this.canvas);
429 430
430 this.distanceMeter.calcXPos(this.dimensions.WIDTH); 431 this.distanceMeter.calcXPos(this.dimensions.WIDTH);
431 this.clearCanvas(); 432 this.clearCanvas();
432 this.horizon.update(0, 0, true); 433 this.horizon.update(0, 0, true);
433 this.tRex.update(0); 434 this.tRex.update(0);
434 435
435 // Outer container and distance meter. 436 // Outer container and distance meter.
436 if (this.activated || this.crashed || this.paused) { 437 if (this.playing || this.crashed || this.paused) {
437 this.containerEl.style.width = this.dimensions.WIDTH + 'px'; 438 this.containerEl.style.width = this.dimensions.WIDTH + 'px';
438 this.containerEl.style.height = this.dimensions.HEIGHT + 'px'; 439 this.containerEl.style.height = this.dimensions.HEIGHT + 'px';
439 this.distanceMeter.update(0, Math.ceil(this.distanceRan)); 440 this.distanceMeter.update(0, Math.ceil(this.distanceRan));
440 this.stop(); 441 this.stop();
441 } else { 442 } else {
442 this.tRex.draw(0, 0); 443 this.tRex.draw(0, 0);
443 } 444 }
444 445
445 // Game over panel. 446 // Game over panel.
446 if (this.crashed && this.gameOverPanel) { 447 if (this.crashed && this.gameOverPanel) {
447 this.gameOverPanel.updateDimensions(this.dimensions.WIDTH); 448 this.gameOverPanel.updateDimensions(this.dimensions.WIDTH);
448 this.gameOverPanel.draw(); 449 this.gameOverPanel.draw();
449 } 450 }
450 } 451 }
451 }, 452 },
452 453
453 /** 454 /**
454 * Play the game intro. 455 * Play the game intro.
455 * Canvas container width expands out to the full width. 456 * Canvas container width expands out to the full width.
456 */ 457 */
457 playIntro: function() { 458 playIntro: function() {
458 if (!this.started && !this.crashed) { 459 if (!this.activated && !this.crashed) {
459 this.playingIntro = true; 460 this.playingIntro = true;
460 this.tRex.playingIntro = true; 461 this.tRex.playingIntro = true;
461 462
462 // CSS animation definition. 463 // CSS animation definition.
463 var keyframes = '@-webkit-keyframes intro { ' + 464 var keyframes = '@-webkit-keyframes intro { ' +
464 'from { width:' + Trex.config.WIDTH + 'px }' + 465 'from { width:' + Trex.config.WIDTH + 'px }' +
465 'to { width: ' + this.dimensions.WIDTH + 'px }' + 466 'to { width: ' + this.dimensions.WIDTH + 'px }' +
466 '}'; 467 '}';
467 document.styleSheets[0].insertRule(keyframes, 0); 468 document.styleSheets[0].insertRule(keyframes, 0);
468 469
469 this.containerEl.addEventListener(Runner.events.ANIM_END, 470 this.containerEl.addEventListener(Runner.events.ANIM_END,
470 this.startGame.bind(this)); 471 this.startGame.bind(this));
471 472
472 this.containerEl.style.webkitAnimation = 'intro .4s ease-out 1 both'; 473 this.containerEl.style.webkitAnimation = 'intro .4s ease-out 1 both';
473 this.containerEl.style.width = this.dimensions.WIDTH + 'px'; 474 this.containerEl.style.width = this.dimensions.WIDTH + 'px';
474 475
475 if (this.touchController) { 476 if (this.touchController) {
476 this.outerContainerEl.appendChild(this.touchController); 477 this.outerContainerEl.appendChild(this.touchController);
477 } 478 }
479 this.playing = true;
478 this.activated = true; 480 this.activated = true;
479 this.started = true;
480 } else if (this.crashed) { 481 } else if (this.crashed) {
481 this.restart(); 482 this.restart();
482 } 483 }
483 }, 484 },
484 485
485 486
486 /** 487 /**
487 * Update the game status to started. 488 * Update the game status to started.
488 */ 489 */
489 startGame: function() { 490 startGame: function() {
(...skipping 13 matching lines...) Expand all
503 window.addEventListener(Runner.events.FOCUS, 504 window.addEventListener(Runner.events.FOCUS,
504 this.onVisibilityChange.bind(this)); 505 this.onVisibilityChange.bind(this));
505 }, 506 },
506 507
507 clearCanvas: function() { 508 clearCanvas: function() {
508 this.canvasCtx.clearRect(0, 0, this.dimensions.WIDTH, 509 this.canvasCtx.clearRect(0, 0, this.dimensions.WIDTH,
509 this.dimensions.HEIGHT); 510 this.dimensions.HEIGHT);
510 }, 511 },
511 512
512 /** 513 /**
513 * Update the game frame. 514 * Update the game frame and schedules the next one.
514 */ 515 */
515 update: function() { 516 update: function() {
516 this.drawPending = false; 517 this.updatePending = false;
517 518
518 var now = getTimeStamp(); 519 var now = getTimeStamp();
519 var deltaTime = now - (this.time || now); 520 var deltaTime = now - (this.time || now);
520 this.time = now; 521 this.time = now;
521 522
522 if (this.activated) { 523 if (this.playing) {
523 this.clearCanvas(); 524 this.clearCanvas();
524 525
525 if (this.tRex.jumping) { 526 if (this.tRex.jumping) {
526 this.tRex.updateJump(deltaTime); 527 this.tRex.updateJump(deltaTime);
527 } 528 }
528 529
529 this.runningTime += deltaTime; 530 this.runningTime += deltaTime;
530 var hasObstacles = this.runningTime > this.config.CLEAR_TIME; 531 var hasObstacles = this.runningTime > this.config.CLEAR_TIME;
531 532
532 // First jump triggers the intro. 533 // First jump triggers the intro.
533 if (this.tRex.jumpCount == 1 && !this.playingIntro) { 534 if (this.tRex.jumpCount == 1 && !this.playingIntro) {
534 this.playIntro(); 535 this.playIntro();
535 } 536 }
536 537
537 // The horizon doesn't move until the intro is over. 538 // The horizon doesn't move until the intro is over.
538 if (this.playingIntro) { 539 if (this.playingIntro) {
539 this.horizon.update(0, this.currentSpeed, hasObstacles); 540 this.horizon.update(0, this.currentSpeed, hasObstacles);
540 } else { 541 } else {
541 deltaTime = !this.started ? 0 : deltaTime; 542 deltaTime = !this.activated ? 0 : deltaTime;
542 this.horizon.update(deltaTime, this.currentSpeed, hasObstacles, 543 this.horizon.update(deltaTime, this.currentSpeed, hasObstacles,
543 this.inverted); 544 this.inverted);
544 } 545 }
545 546
546 // Check for collisions. 547 // Check for collisions.
547 var collision = hasObstacles && 548 var collision = hasObstacles &&
548 checkForCollision(this.horizon.obstacles[0], this.tRex); 549 checkForCollision(this.horizon.obstacles[0], this.tRex);
549 550
550 if (!collision) { 551 if (!collision) {
551 this.distanceRan += this.currentSpeed * deltaTime / this.msPerFrame; 552 this.distanceRan += this.currentSpeed * deltaTime / this.msPerFrame;
(...skipping 28 matching lines...) Expand all
580 this.config.INVERT_DISTANCE); 581 this.config.INVERT_DISTANCE);
581 582
582 if (this.invertTrigger && this.invertTimer === 0) { 583 if (this.invertTrigger && this.invertTimer === 0) {
583 this.invertTimer += deltaTime; 584 this.invertTimer += deltaTime;
584 this.invert(); 585 this.invert();
585 } 586 }
586 } 587 }
587 } 588 }
588 } 589 }
589 590
590 if (!this.crashed) { 591 if (this.playing || (!this.activated &&
592 this.tRex.blinkCount < Runner.config.MAX_BLINK_COUNT)) {
591 this.tRex.update(deltaTime); 593 this.tRex.update(deltaTime);
592 this.raq(); 594 this.scheduleNextUpdate();
593 } 595 }
594 }, 596 },
595 597
596 /** 598 /**
597 * Event handler. 599 * Event handler.
598 */ 600 */
599 handleEvent: function(e) { 601 handleEvent: function(e) {
600 return (function(evtType, events) { 602 return (function(evtType, events) {
601 switch (evtType) { 603 switch (evtType) {
602 case events.KEYDOWN: 604 case events.KEYDOWN:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 document.removeEventListener(Runner.events.MOUSEUP, this); 651 document.removeEventListener(Runner.events.MOUSEUP, this);
650 } 652 }
651 }, 653 },
652 654
653 /** 655 /**
654 * Process keydown. 656 * Process keydown.
655 * @param {Event} e 657 * @param {Event} e
656 */ 658 */
657 onKeyDown: function(e) { 659 onKeyDown: function(e) {
658 // Prevent native page scrolling whilst tapping on mobile. 660 // Prevent native page scrolling whilst tapping on mobile.
659 if (IS_MOBILE && this.activated) { 661 if (IS_MOBILE && this.playing) {
660 e.preventDefault(); 662 e.preventDefault();
661 } 663 }
662 664
663 if (e.target != this.detailsButton) { 665 if (e.target != this.detailsButton) {
664 if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] || 666 if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] ||
665 e.type == Runner.events.TOUCHSTART)) { 667 e.type == Runner.events.TOUCHSTART)) {
666 if (!this.activated) { 668 if (!this.playing) {
667 this.loadSounds(); 669 this.loadSounds();
668 this.activated = true; 670 this.playing = true;
671 this.scheduleNextUpdate();
669 if (window.errorPageController) { 672 if (window.errorPageController) {
670 errorPageController.trackEasterEgg(); 673 errorPageController.trackEasterEgg();
671 } 674 }
672 } 675 }
673 676 // Play sound effect and jump on starting the game for the first time.
674 if (!this.tRex.jumping && !this.tRex.ducking) { 677 if (!this.tRex.jumping && !this.tRex.ducking) {
675 this.playSound(this.soundFx.BUTTON_PRESS); 678 this.playSound(this.soundFx.BUTTON_PRESS);
676 this.tRex.startJump(this.currentSpeed); 679 this.tRex.startJump(this.currentSpeed);
677 } 680 }
678 } 681 }
679 682
680 if (this.crashed && e.type == Runner.events.TOUCHSTART && 683 if (this.crashed && e.type == Runner.events.TOUCHSTART &&
681 e.currentTarget == this.containerEl) { 684 e.currentTarget == this.containerEl) {
682 this.restart(); 685 this.restart();
683 } 686 }
684 } 687 }
685 688
686 if (this.activated && !this.crashed && Runner.keycodes.DUCK[e.keyCode]) { 689 if (this.playing && !this.crashed && Runner.keycodes.DUCK[e.keyCode]) {
687 e.preventDefault(); 690 e.preventDefault();
688 if (this.tRex.jumping) { 691 if (this.tRex.jumping) {
689 // Speed drop, activated only when jump key is not pressed. 692 // Speed drop, activated only when jump key is not pressed.
690 this.tRex.setSpeedDrop(); 693 this.tRex.setSpeedDrop();
691 } else if (!this.tRex.jumping && !this.tRex.ducking) { 694 } else if (!this.tRex.jumping && !this.tRex.ducking) {
692 // Duck. 695 // Duck.
693 this.tRex.setDuck(true); 696 this.tRex.setDuck(true);
694 } 697 }
695 } 698 }
696 }, 699 },
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 * @return {boolean} 737 * @return {boolean}
735 */ 738 */
736 isLeftClickOnCanvas: function(e) { 739 isLeftClickOnCanvas: function(e) {
737 return e.button != null && e.button < 2 && 740 return e.button != null && e.button < 2 &&
738 e.type == Runner.events.MOUSEUP && e.target == this.canvas; 741 e.type == Runner.events.MOUSEUP && e.target == this.canvas;
739 }, 742 },
740 743
741 /** 744 /**
742 * RequestAnimationFrame wrapper. 745 * RequestAnimationFrame wrapper.
743 */ 746 */
744 raq: function() { 747 scheduleNextUpdate: function() {
745 if (!this.drawPending) { 748 if (!this.updatePending) {
746 this.drawPending = true; 749 this.updatePending = true;
747 this.raqId = requestAnimationFrame(this.update.bind(this)); 750 this.raqId = requestAnimationFrame(this.update.bind(this));
748 } 751 }
749 }, 752 },
750 753
751 /** 754 /**
752 * Whether the game is running. 755 * Whether the game is running.
753 * @return {boolean} 756 * @return {boolean}
754 */ 757 */
755 isRunning: function() { 758 isRunning: function() {
756 return !!this.raqId; 759 return !!this.raqId;
(...skipping 25 matching lines...) Expand all
782 if (this.distanceRan > this.highestScore) { 785 if (this.distanceRan > this.highestScore) {
783 this.highestScore = Math.ceil(this.distanceRan); 786 this.highestScore = Math.ceil(this.distanceRan);
784 this.distanceMeter.setHighScore(this.highestScore); 787 this.distanceMeter.setHighScore(this.highestScore);
785 } 788 }
786 789
787 // Reset the time clock. 790 // Reset the time clock.
788 this.time = getTimeStamp(); 791 this.time = getTimeStamp();
789 }, 792 },
790 793
791 stop: function() { 794 stop: function() {
792 this.activated = false; 795 this.playing = false;
793 this.paused = true; 796 this.paused = true;
794 cancelAnimationFrame(this.raqId); 797 cancelAnimationFrame(this.raqId);
795 this.raqId = 0; 798 this.raqId = 0;
796 }, 799 },
797 800
798 play: function() { 801 play: function() {
799 if (!this.crashed) { 802 if (!this.crashed) {
800 this.activated = true; 803 this.playing = true;
801 this.paused = false; 804 this.paused = false;
802 this.tRex.update(0, Trex.status.RUNNING); 805 this.tRex.update(0, Trex.status.RUNNING);
803 this.time = getTimeStamp(); 806 this.time = getTimeStamp();
804 this.update(); 807 this.update();
805 } 808 }
806 }, 809 },
807 810
808 restart: function() { 811 restart: function() {
809 if (!this.raqId) { 812 if (!this.raqId) {
810 this.playCount++; 813 this.playCount++;
811 this.runningTime = 0; 814 this.runningTime = 0;
812 this.activated = true; 815 this.playing = true;
813 this.crashed = false; 816 this.crashed = false;
814 this.distanceRan = 0; 817 this.distanceRan = 0;
815 this.setSpeed(this.config.SPEED); 818 this.setSpeed(this.config.SPEED);
816 this.time = getTimeStamp(); 819 this.time = getTimeStamp();
817 this.containerEl.classList.remove(Runner.classes.CRASHED); 820 this.containerEl.classList.remove(Runner.classes.CRASHED);
818 this.clearCanvas(); 821 this.clearCanvas();
819 this.distanceMeter.reset(this.highestScore); 822 this.distanceMeter.reset(this.highestScore);
820 this.horizon.reset(); 823 this.horizon.reset();
821 this.tRex.reset(); 824 this.tRex.reset();
822 this.playSound(this.soundFx.BUTTON_PRESS); 825 this.playSound(this.soundFx.BUTTON_PRESS);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 this.canvas = canvas; 1484 this.canvas = canvas;
1482 this.canvasCtx = canvas.getContext('2d'); 1485 this.canvasCtx = canvas.getContext('2d');
1483 this.spritePos = spritePos; 1486 this.spritePos = spritePos;
1484 this.xPos = 0; 1487 this.xPos = 0;
1485 this.yPos = 0; 1488 this.yPos = 0;
1486 // Position when on the ground. 1489 // Position when on the ground.
1487 this.groundYPos = 0; 1490 this.groundYPos = 0;
1488 this.currentFrame = 0; 1491 this.currentFrame = 0;
1489 this.currentAnimFrames = []; 1492 this.currentAnimFrames = [];
1490 this.blinkDelay = 0; 1493 this.blinkDelay = 0;
1494 this.blinkCount = 0;
1491 this.animStartTime = 0; 1495 this.animStartTime = 0;
1492 this.timer = 0; 1496 this.timer = 0;
1493 this.msPerFrame = 1000 / FPS; 1497 this.msPerFrame = 1000 / FPS;
1494 this.config = Trex.config; 1498 this.config = Trex.config;
1495 // Current status. 1499 // Current status.
1496 this.status = Trex.status.WAITING; 1500 this.status = Trex.status.WAITING;
1497 1501
1498 this.jumping = false; 1502 this.jumping = false;
1499 this.ducking = false; 1503 this.ducking = false;
1500 this.jumpVelocity = 0; 1504 this.jumpVelocity = 0;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 } 1597 }
1594 }; 1598 };
1595 1599
1596 1600
1597 Trex.prototype = { 1601 Trex.prototype = {
1598 /** 1602 /**
1599 * T-rex player initaliser. 1603 * T-rex player initaliser.
1600 * Sets the t-rex to blink at random intervals. 1604 * Sets the t-rex to blink at random intervals.
1601 */ 1605 */
1602 init: function() { 1606 init: function() {
1603 this.blinkDelay = this.setBlinkDelay();
1604 this.groundYPos = Runner.defaultDimensions.HEIGHT - this.config.HEIGHT - 1607 this.groundYPos = Runner.defaultDimensions.HEIGHT - this.config.HEIGHT -
1605 Runner.config.BOTTOM_PAD; 1608 Runner.config.BOTTOM_PAD;
1606 this.yPos = this.groundYPos; 1609 this.yPos = this.groundYPos;
1607 this.minJumpHeight = this.groundYPos - this.config.MIN_JUMP_HEIGHT; 1610 this.minJumpHeight = this.groundYPos - this.config.MIN_JUMP_HEIGHT;
1608 1611
1609 this.draw(0, 0); 1612 this.draw(0, 0);
1610 this.update(0, Trex.status.WAITING); 1613 this.update(0, Trex.status.WAITING);
1611 }, 1614 },
1612 1615
1613 /** 1616 /**
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1722 blink: function(time) { 1725 blink: function(time) {
1723 var deltaTime = time - this.animStartTime; 1726 var deltaTime = time - this.animStartTime;
1724 1727
1725 if (deltaTime >= this.blinkDelay) { 1728 if (deltaTime >= this.blinkDelay) {
1726 this.draw(this.currentAnimFrames[this.currentFrame], 0); 1729 this.draw(this.currentAnimFrames[this.currentFrame], 0);
1727 1730
1728 if (this.currentFrame == 1) { 1731 if (this.currentFrame == 1) {
1729 // Set new random delay to blink. 1732 // Set new random delay to blink.
1730 this.setBlinkDelay(); 1733 this.setBlinkDelay();
1731 this.animStartTime = time; 1734 this.animStartTime = time;
1735 this.blinkCount++;
1732 } 1736 }
1733 } 1737 }
1734 }, 1738 },
1735 1739
1736 /** 1740 /**
1737 * Initialise a jump. 1741 * Initialise a jump.
1738 * @param {number} speed 1742 * @param {number} speed
1739 */ 1743 */
1740 startJump: function(speed) { 1744 startJump: function(speed) {
1741 if (!this.jumping) { 1745 if (!this.jumping) {
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 2692
2689 /** 2693 /**
2690 * Add a new cloud to the horizon. 2694 * Add a new cloud to the horizon.
2691 */ 2695 */
2692 addCloud: function() { 2696 addCloud: function() {
2693 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD, 2697 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD,
2694 this.dimensions.WIDTH)); 2698 this.dimensions.WIDTH));
2695 } 2699 }
2696 }; 2700 };
2697 })(); 2701 })();
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698