From ec7827892bde11b16ded0f1b9094779659b93db6 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 9 Mar 2018 15:10:16 +0100 Subject: [PATCH] Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 146 bytes modified --- 78gnds8jrj.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/78gnds8jrj.js b/78gnds8jrj.js index 797c971..aeb2c7d 100644 --- a/78gnds8jrj.js +++ b/78gnds8jrj.js @@ -34,11 +34,6 @@ this.sections = []; */ this.camera = GameLib.EntityManager.Instance.findComponentById('hd8dsn7o4c'); -/** - * Game Variables - */ -this.snail.position.z = 0; -this.speed = 0; var cloneLeft = this.treesLeft.clone(); var cloneRoad = this.road.clone(); @@ -63,14 +58,29 @@ this.sections.push({ right : cloneRight }) -/** - * Activate our custom code components - */ -this.beforeRender.entityLoaded = this; -this.mouseMove.entityLoaded = this; -this.mouseDown.entityLoaded = this; -this.mouseUp.entityLoaded = this; -this.keyDown.entityLoaded = this; -this.keyUp.entityLoaded = this; +GameLib.Event.Subscribe( + GameLib.Event.GAME_START, + function() { + /** + * Game Variables + */ + this.snail.position.z = 0; + this.speed = 0; + this.speedUp = false; + + /** + * Activate our custom code components + */ + this.beforeRender.entityLoaded = this; + this.mouseMove.entityLoaded = this; + this.mouseDown.entityLoaded = this; + this.mouseUp.entityLoaded = this; + this.keyDown.entityLoaded = this; + this.keyUp.entityLoaded = this; + + }.bind(this) +); + + //@ sourceURL=entityLoaded.js \ No newline at end of file