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

Unified Diff: components/neterror/resources/offline.js

Issue 2747773002: Offline easter egg - Fix incorrect score when restarting from a paused game (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/neterror/resources/offline.js
diff --git a/components/neterror/resources/offline.js b/components/neterror/resources/offline.js
index 79ffa5c4da8945302dbeb334c82e94d4ae0e2aff..e817591dbb72999a68a163bc2de078ad14d74036 100644
--- a/components/neterror/resources/offline.js
+++ b/components/neterror/resources/offline.js
@@ -661,38 +661,40 @@ Runner.prototype = {
e.preventDefault();
mmenke 2017/03/20 15:11:28 Is this the right thing to do if e.target == this.
edwardjung 2017/03/21 18:51:21 Yes, as during game play you don't want to be acci
}
- if (e.target != this.detailsButton) {
- if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] ||
- e.type == Runner.events.TOUCHSTART)) {
- if (!this.playing) {
- this.loadSounds();
- this.playing = true;
- this.update();
- if (window.errorPageController) {
- errorPageController.trackEasterEgg();
+ if (!this.paused) {
mmenke 2017/03/20 15:11:28 Exactly what line are you trying to skip here? I
edwardjung 2017/03/21 18:51:21 this.update(); As the delta time is calculated wh
+ if (e.target != this.detailsButton) {
+ if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] ||
+ e.type == Runner.events.TOUCHSTART)) {
+ if (!this.playing) {
+ this.loadSounds();
+ this.playing = true;
+ this.update();
+ if (window.errorPageController) {
+ errorPageController.trackEasterEgg();
+ }
+ }
+ // Play sound effect and jump on starting the game for the first time.
+ if (!this.tRex.jumping && !this.tRex.ducking) {
+ this.playSound(this.soundFx.BUTTON_PRESS);
+ this.tRex.startJump(this.currentSpeed);
}
}
- // Play sound effect and jump on starting the game for the first time.
- if (!this.tRex.jumping && !this.tRex.ducking) {
- this.playSound(this.soundFx.BUTTON_PRESS);
- this.tRex.startJump(this.currentSpeed);
- }
- }
- if (this.crashed && e.type == Runner.events.TOUCHSTART &&
- e.currentTarget == this.containerEl) {
- this.restart();
+ if (this.crashed && e.type == Runner.events.TOUCHSTART &&
+ e.currentTarget == this.containerEl) {
+ this.restart();
+ }
}
- }
- if (this.playing && !this.crashed && Runner.keycodes.DUCK[e.keyCode]) {
- e.preventDefault();
- if (this.tRex.jumping) {
- // Speed drop, activated only when jump key is not pressed.
- this.tRex.setSpeedDrop();
- } else if (!this.tRex.jumping && !this.tRex.ducking) {
- // Duck.
- this.tRex.setDuck(true);
+ if (this.playing && !this.crashed && Runner.keycodes.DUCK[e.keyCode]) {
+ e.preventDefault();
+ if (this.tRex.jumping) {
+ // Speed drop, activated only when jump key is not pressed.
+ this.tRex.setSpeedDrop();
+ } else if (!this.tRex.jumping && !this.tRex.ducking) {
+ // Duck.
+ this.tRex.setDuck(true);
+ }
}
}
},
@@ -812,6 +814,7 @@ Runner.prototype = {
this.playCount++;
this.runningTime = 0;
this.playing = true;
+ this.paused = false;
this.crashed = false;
this.distanceRan = 0;
this.setSpeed(this.config.SPEED);
« 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