From 3c7d94609cdb52d8b6821f501aee76af6f594650 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 25 Nov 2017 09:30:27 +0100 Subject: [PATCH] Update: CC - Mouse Down (zjg1mprub2.js) 33 bytes modified --- zjg1mprub2.js | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/zjg1mprub2.js b/zjg1mprub2.js index 307910b..138d9d2 100644 --- a/zjg1mprub2.js +++ b/zjg1mprub2.js @@ -9,19 +9,12 @@ if (!this.initialized) { this.throwerParticleEngine = this.entityLoaded.throwerParticleEngine; this.beforeRender = this.entityLoaded.beforeRender; this.mouseMove = this.entityLoaded.mouseMove; - this.initialized = true; -} - -this.beforeRender.mouseIsDown = true; -this.mouseMove.mouseIsDown = true; - -this.throwerParticleEngine.enabled = true; -this.throwerParticleEngine.particlesPerSecond = 50; -this.throwerParticleEngine.updateInstance('particlesPerSecond'); -this.throwerParticleEngine.templateParticle.speed = 300; -this.throwerParticleEngine.templateParticle.scale.x = 15; - -if (GameLib.Utils.UndefinedOrNull(this.subscription)) { + + if (this.subscription) { + this.subscription.remove(); + this.subscription = null; + } + this.subscription = GameLib.Event.Subscribe( GameLib.Event.AUDIO_ENDED, function(data) { @@ -34,8 +27,19 @@ if (GameLib.Utils.UndefinedOrNull(this.subscription)) { } }.bind(this) ); + + this.initialized = true; } +this.beforeRender.mouseIsDown = true; +this.mouseMove.mouseIsDown = true; + +this.throwerParticleEngine.enabled = true; +this.throwerParticleEngine.particlesPerSecond = 50; +this.throwerParticleEngine.updateInstance('particlesPerSecond'); +this.throwerParticleEngine.templateParticle.speed = 300; +this.throwerParticleEngine.templateParticle.scale.x = 15; + GameLib.Event.Emit( GameLib.Event.PLAY_AUDIO, {