Skip to content

Commit 73f3760

Browse files
committed
trungvose#7 | Reset the state to inital on gameOver, only keep the max
1 parent 27cf115 commit 73f3760

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/app/state/tetris/tetris.service.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,12 @@ export class TetrisService {
244244
this._soundManager.gameOver();
245245
let { points, max } = this._query.raw;
246246
let maxPoint = Math.max(points, max);
247+
LocalStorageService.setMaxPoint(maxPoint);
247248
this._store.update({
248-
gameState: GameState.Over,
249-
current: null,
249+
...createInitialState(this._pieceFactory),
250250
max: maxPoint,
251-
points: 0
251+
gameState: GameState.Over,
252252
});
253-
LocalStorageService.setMaxPoint(maxPoint);
254253
}
255254

256255
private get _isCollidesBottom(): boolean {

0 commit comments

Comments
 (0)