Skip to content

Commit ab0e4d3

Browse files
committed
Rename onRestart()
1 parent 32920bc commit ab0e4d3

File tree

7 files changed

+8
-9
lines changed

7 files changed

+8
-9
lines changed

src/apps/genetic-nn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function setup() {
1414
// Initialize the game Runner.
1515
runner = new Runner('.game', {
1616
T_REX_COUNT: 4,
17-
onRestart: handleRestart,
17+
onReset: handleRestart,
1818
onCrash: handleCrash,
1919
onRunning: handleRunning
2020
});

src/apps/genetic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function setup() {
1717
// Initialize the game Runner.
1818
runner = new Runner('.game', {
1919
T_REX_COUNT: 10,
20-
onRestart: handleRestart,
20+
onReset: handleRestart,
2121
onCrash: handleCrash,
2222
onRunning: handleRunning
2323
});

src/apps/nn.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function setup() {
1010
// Initialize the game Runner.
1111
runner = new Runner('.game', {
1212
T_REX_COUNT: 1,
13-
onRestart: handleRestart,
13+
onReset: handleRestart,
1414
onCrash: handleCrash,
1515
onRunning: handleRunning
1616
});

src/apps/nnm.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function setup() {
1010
// Initialize the game Runner.
1111
runner = new Runner('.game', {
1212
T_REX_COUNT: 3,
13-
onRestart: handleRestart,
13+
onReset: handleRestart,
1414
onCrash: handleCrash,
1515
onRunning: handleRunning
1616
});

src/apps/random.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function setup() {
1010
// Initialize the game Runner.
1111
runner = new Runner('.game', {
1212
T_REX_COUNT: 10,
13-
onRestart: handleRestart,
13+
onReset: handleRestart,
1414
onCrash: handleCrash,
1515
onRunning: handleRunning
1616
});

src/apps/template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let runner = null;
88
function setup() {
99
// Initialize the game Runner.
1010
runner = new Runner('.game', {
11-
onRestart: handleRestart,
11+
onReset: handleRestart,
1212
onRunning: handleRunning,
1313
onCrash: handleCrash
1414
});

src/game/Runner.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ export default class Runner {
168168

169169
// Draw t-rex
170170
this.tRexGroup = new TrexGroup(this.config.T_REX_COUNT, this.canvas, this.spriteDef.TREX);
171-
this.tRexGroup.onReset = this.config.onReset;
172171
this.tRexGroup.onRunning = this.config.onRunning;
173172
this.tRexGroup.onCrash = this.config.onCrash;
174173
this.tRex = this.tRexGroup.tRexes[0];
@@ -448,12 +447,12 @@ export default class Runner {
448447
this.distanceMeter.reset(this.highestScore);
449448
this.horizon.reset();
450449
this.tRexGroup.reset();
451-
this.config.onRestart(this.tRexGroup.tRexes);
450+
this.config.onReset(this.tRexGroup.tRexes);
452451
this.update();
453452
} else {
454453
this.isFirstTime = true;
455454
this.tRexGroup.reset();
456-
this.config.onRestart(this.tRexGroup.tRexes);
455+
this.config.onReset(this.tRexGroup.tRexes);
457456
if (!this.playing) {
458457
this.playing = true;
459458
this.update();

0 commit comments

Comments
 (0)