Skip to content

Commit

Permalink
fix(game): Init variables in constructor to allow overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
Ishadijcks committed Oct 7, 2021
1 parent c7d3bac commit 1d7e424
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ig-template/IgtGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export abstract class IgtGame {
* How often the game should be saved
*/
protected readonly SAVE_INTERVAL: number = 30;
protected _nextSave = this.SAVE_INTERVAL;
protected saveEncoder: IgtSaveEncoder = new DefaultSaveEncoder();
protected _nextSave: number;
protected saveEncoder: IgtSaveEncoder;

protected gameSpeed: number = 1;
protected _lastUpdate: number = 0;
Expand All @@ -45,6 +45,8 @@ export abstract class IgtGame {

protected constructor() {
this.state = GameState.Launching;
this._nextSave = this.SAVE_INTERVAL;
this.saveEncoder = new DefaultSaveEncoder();
}

public getDeveloperPanel(): DeveloperPanel {
Expand Down

0 comments on commit 1d7e424

Please # to comment.