Update: CC - Entity Loaded - AR Football 3 (ff0fsum4zx.js) 54 bytes modified

beta.r3js.org
Theunis Johannes Botha 2018-05-28 19:01:48 +02:00
parent 15d4e3cb57
commit cb56d0778a
1 changed files with 27 additions and 21 deletions

View File

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