From 1da8dc6b885ea772f2c3612746b678d5a56bea87 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Thu, 16 Nov 2017 21:17:03 +0100 Subject: [PATCH] Initial Commit: CC - Mouse Down (xthva3e5s8.js) --- xthva3e5s8.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 xthva3e5s8.js diff --git a/xthva3e5s8.js b/xthva3e5s8.js new file mode 100644 index 0000000..832050c --- /dev/null +++ b/xthva3e5s8.js @@ -0,0 +1,45 @@ +if (!this.entityLoaded) { + return; +} + +if (!this.initialized) { + /** + * Link some objects for MouseDown component + */ + 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; + +GameLib.Event.Emit( + GameLib.Event.PLAY_AUDIO, + { + name : 'Audio - Flamethrower' + } +); + +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