diff --git a/xtihcyhagp.js b/xtihcyhagp.js index c0e6476..870165d 100644 --- a/xtihcyhagp.js +++ b/xtihcyhagp.js @@ -107,6 +107,22 @@ GameLib.Event.Subscribe( }.bind(this) ); +GameLib.Event.Subscribe( + GameLib.Event.GAME_RESTART, + function() { + console.log('restarting game'); + + this.beforeRender.entityLoaded = null; + this.mouseUp.entityLoaded = null; + this.mouseDown.entityLoaded = null; + this.mouseMove.entityLoaded = null; + + this.beforeRender.initialized = false; + GameLib.Event.Emit(GameLib.Event.STOP_ALL_AUDIO); + GameLib.Event.Emit(GameLib.Event.GAME_START); + }.bind(this) +); + GameLib.Event.Subscribe( GameLib.Event.GAME_OVER, function() {