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