From 7944546f57d596e6e7129bb66d0f985dd92edfa0 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Mon, 27 Nov 2017 10:33:54 +0100 Subject: [PATCH] Initial Commit: CC - Mouse Down (b8gasgkbnl.js) --- b8gasgkbnl.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 b8gasgkbnl.js diff --git a/b8gasgkbnl.js b/b8gasgkbnl.js new file mode 100644 index 0000000..6440feb --- /dev/null +++ b/b8gasgkbnl.js @@ -0,0 +1,49 @@ +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; + + if (this.subscription) { + this.subscription.remove(); + this.subscription = null; + } + + this.subscription = GameLib.Event.Subscribe( + GameLib.Event.AUDIO_ENDED, + function(data) { + if (data.audio.name === 'Audio - Flamethrower') { + if (!data.audio.paused) { + GameLib.Event.Emit(GameLib.Event.MOUSE_UP); + } + } + }.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, + { + name : 'Audio - Flamethrower' + } +); + +return null; +//@ sourceURL=mouseDown.js \ No newline at end of file