From da322487f12ef46044d1ef637df5d79de40fd246 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Sat, 25 Nov 2017 08:52:11 +0100 Subject: [PATCH] Update: CC - Mouse Down (zjg1mprub2.js) 70 bytes modified --- zjg1mprub2.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/zjg1mprub2.js b/zjg1mprub2.js index 832050c..307910b 100644 --- a/zjg1mprub2.js +++ b/zjg1mprub2.js @@ -21,6 +21,21 @@ this.throwerParticleEngine.updateInstance('particlesPerSecond'); this.throwerParticleEngine.templateParticle.speed = 300; this.throwerParticleEngine.templateParticle.scale.x = 15; +if (GameLib.Utils.UndefinedOrNull(this.subscription)) { + this.subscription = GameLib.Event.Subscribe( + GameLib.Event.AUDIO_ENDED, + function(data) { + if (data.audio.name === 'Audio - Flamethrower') { + GameLib.Event.Emit(GameLib.Event.MOUSE_UP); + if (this.subscription) { + this.subscription.remove(); + this.subscription = null; + } + } + }.bind(this) + ); +} + GameLib.Event.Emit( GameLib.Event.PLAY_AUDIO, { @@ -28,18 +43,5 @@ GameLib.Event.Emit( } ); -this.subscription = GameLib.Event.Subscribe( - GameLib.Event.AUDIO_ENDED, - function(data) { - if (data.audio.name === 'Audio - Flamethrower') { - GameLib.Event.Emit(GameLib.Event.MOUSE_UP); - if (this.subscription) { - this.subscription.remove(); - this.subscription = null; - } - } - }.bind(this) -); - return null; //@ sourceURL=mouseDown.js \ No newline at end of file