diff --git a/ff0fsum4zx.js b/ff0fsum4zx.js index 1407516..cc23228 100644 --- a/ff0fsum4zx.js +++ b/ff0fsum4zx.js @@ -127,16 +127,13 @@ R3.CustomCode.prototype.render = function(delta) { if (this.shooting === true) { this.move( + { x : 0, - y : 10 * delta + y : 1000 * delta } ); - if (this.playerRotation.y < 0) { - this.playerRotation.y = 0; - this.shooting = false; - } } if (this.totalTime <= 0) { @@ -328,7 +325,7 @@ R3.CustomCode.prototype.render = function(delta) { R3.CustomCode.prototype.move = function(data) { var x = 0; - + if (data && data.x) { if (this.invertX) { x = data.x; @@ -336,22 +333,22 @@ R3.CustomCode.prototype.move = function(data) { x = -data.x; } } - + var y = 0; - + if (data && data.y) { - + if (this.invertY) { y = data.y; } else { y = -data.y; } - - } - + + } + x *= 0.0025; y *= 0.0075; - + this.playerRotation.x += x; this.playerRotation.y += y; @@ -360,7 +357,7 @@ R3.CustomCode.prototype.move = function(data) { * Clamp player rotation to values between 0 and Math.PI * 2 */ if (this.playerRotation.y > Math.PI) { - this.playerRotation.y = Math.PI; + this.playerRotation.y = 0; } if (this.playerRotation.y < -Math.PI) { @@ -393,7 +390,7 @@ R3.CustomCode.prototype.move = function(data) { this.startTime = Date.now(); } - this.kickDistance += Math.abs(y); + //this.kickDistance += Math.abs(y); } @@ -402,7 +399,7 @@ R3.CustomCode.prototype.move = function(data) { * We are no longer moving down, also reset our Y distance counter * @type {boolean} */ - this.kickDistance = 0; + //this.kickDistance = 0; this.startTime = null; } @@ -430,6 +427,8 @@ R3.CustomCode.prototype.move = function(data) { this.kick = false; + this.shooting = false; + if (this.startTime === null) { console.warn('no kick start time'); return; @@ -442,9 +441,11 @@ R3.CustomCode.prototype.move = function(data) { } ); - var kickDuration = Date.now() - this.startTime; + //var kickDuration = 1;//Date.now() - this.startTime; - var speed = this.kickDistance / kickDuration * 20; + var speed = this.kickDistance; + + console.log('speed = ' + speed); // if (speed > 1.5) { // speed = 1.5; @@ -476,7 +477,7 @@ R3.CustomCode.prototype.move = function(data) { kickDuration : this.kickDuration, kickDistance : this.kickDistance, kickSpeed : speed, - upAngle : Math.PI * speed, + upAngle : speed, v : v, vRotationAxis : vRotationAxis, t : 0, @@ -492,7 +493,7 @@ R3.CustomCode.prototype.move = function(data) { this.activeBall = null; } -}.bind(this) +}.bind(this); R3.Event.Subscribe( @@ -541,8 +542,13 @@ R3.Event.Subscribe( } if (data.type === 'shoot_release') { - console.log('shoot release'); this.shooting = true; + + + + this.kickDistance = Math.abs(this.playerRotation.y); + + } if (data.type === 'look_left') {