From 1d7e424f53c3165c7e1e13aabfad5f132129ddc8 Mon Sep 17 00:00:00 2001 From: Isha Date: Thu, 7 Oct 2021 11:23:49 +0200 Subject: [PATCH] fix(game): Init variables in constructor to allow overriding --- src/ig-template/IgtGame.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ig-template/IgtGame.ts b/src/ig-template/IgtGame.ts index 04a58c7..72742fd 100644 --- a/src/ig-template/IgtGame.ts +++ b/src/ig-template/IgtGame.ts @@ -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; @@ -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 {