From 4a384b3e5b9cbe685743d95f3b94e6e1cbe21b70 Mon Sep 17 00:00:00 2001 From: Theunis Johannes Botha Date: Mon, 28 May 2018 18:59:17 +0200 Subject: [PATCH] Update: CC - Entity Loaded - AR Football 3 (ff0fsum4zx.js) 485 bytes modified --- ff0fsum4zx.js | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/ff0fsum4zx.js b/ff0fsum4zx.js index 8b3240f..1407516 100644 --- a/ff0fsum4zx.js +++ b/ff0fsum4zx.js @@ -85,6 +85,8 @@ this.invertY = true; this.invertX = true; +this.shooting = false; + if (this.debug) { this.arrowHelper = new THREE.ArrowHelper( new THREE.Vector3(0,0,-1), @@ -120,7 +122,22 @@ R3.CustomCode.prototype.render = function(delta) { type : 'timer', time : this.totalTime } - ) + ); + + if (this.shooting === true) { + + this.move( + { + x : 0, + y : 10 * delta + } + ); + + if (this.playerRotation.y < 0) { + this.playerRotation.y = 0; + this.shooting = false; + } + } if (this.totalTime <= 0) { @@ -508,12 +525,24 @@ R3.Event.Subscribe( R3.Event.Subscribe( R3.Event.GAME_DATA, function(data) { - if (data.type === 'shoot_start') { - console.log('shoot start'); + + if (data.type === 'shoot') { + + console.log('shoot'); + + this.shooting = false; + + this.move( + { + x : 0, + y : -10 + } + ); } if (data.type === 'shoot_release') { console.log('shoot release'); + this.shooting = true; } if (data.type === 'look_left') { @@ -522,7 +551,7 @@ R3.Event.Subscribe( x : -10, y : 0 } - ) + ); } if (data.type === 'look_right') { @@ -531,7 +560,7 @@ R3.Event.Subscribe( x : 10, y : 0 } - ) + ); } }.bind(this)