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

beta.r3js.org
Theunis Johannes Botha 2018-05-28 18:59:17 +02:00
parent 85ff364169
commit 4a384b3e5b
1 changed files with 34 additions and 5 deletions

View File

@ -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)