Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 365 bytes modified

beta.r3js.org
-=yb4f310 2018-03-09 18:39:00 +01:00
parent 8a7617c70f
commit 8506c64d04
1 changed files with 26 additions and 36 deletions

View File

@ -34,6 +34,8 @@ this.clouds = [];
this.maxSpeed = 50;
this.speedPercentage = 0;
this.cloudTime = 0;
/**
* Camera settings y = height, z = FOV
*/
@ -92,7 +94,9 @@ GameLib.CustomCode.prototype.spawnRoadSections = function() {
}.bind(this)
GameLib.CustomCode.prototype.advanceClouds = function(diff) {
GameLib.CustomCode.prototype.advanceClouds = function(delta) {
var diff = delta * this.speed;
var cloudInfo = this.clouds.reduce(
function(result, cloud) {
@ -122,9 +126,20 @@ GameLib.CustomCode.prototype.advanceClouds = function(diff) {
deadCloud.remove();
}
)
this.cloudTime += diff;
if (this.cloudTime > 1) {
this.spawnCloud();
this.cloudTime = 0;
}
}.bind(this);
GameLib.CustomCode.prototype.advanceRoadSections = function(diff) {
GameLib.CustomCode.prototype.advanceRoadSections = function(delta) {
var diff = delta * this.speed;
this.sections.map(
function(section) {
section.left.position.x += diff;
@ -144,31 +159,12 @@ GameLib.CustomCode.prototype.advanceRoadSections = function(diff) {
);
}.bind(this);
GameLib.CustomCode.prototype.advanceCamera = function(delta) {
//this.camera.position.z = this.snail.position.z;
//this.camera.updateInstance('position');
// var modified = false;
// if ((this.camera.position.z - this.snail.position.z) > (0.05)) {
// this.camera.position.z -= this.speed * delta;
// modified = true;
// }
// if ((this.snail.position.z - this.camera.position.z) > (0.05)) {
// this.camera.position.z += this.speed * delta;
// modified = true;
// }
// if (modified) {
// this.camera.lookAt.x = this.snail.position.x;
// this.camera.lookAt.y = this.snail.position.y;
// this.camera.lookAt.z = this.snail.position.z;
//this.camera.updateInstance('position');
//this.camera.updateInstance('lookAt');
// }
GameLib.CustomCode.prototype.adjustCamera = function(delta) {
/**
* We don't adjust the camera anymore since it affects the ray-tracing in mouse-move
* An update here causes a slightly different 3d mouse location on mouse move which
* immediately causes a new snail position: resulting in jitter
*/
}.bind(this);
GameLib.CustomCode.prototype.adjustSpeed = function(delta) {
@ -201,12 +197,10 @@ GameLib.CustomCode.prototype.adjustSpeed = function(delta) {
this.camera.fov = this.currentCameraSettings.z;
this.camera.updateInstance('fov');
}.bind(this);
GameLib.CustomCode.prototype.adjustSnailPosition = function(delta) {
this.currentSnailSettings.lerpVectors(
this.initialSnailSettings,
this.maximumSnailSettings,
@ -250,13 +244,7 @@ GameLib.CustomCode.prototype.update3dCursor = function() {
);
this.targetSnailPosition.z = cursorPosition.z;
// this.sun.position.setFrom(cursorPosition);
// this.sun.updateInstance('position');
//cursorPosition.z = 3;
//this.lookAtTarget = cursorPosition;
}.bind(this);
GameLib.Event.Subscribe(
@ -286,6 +274,8 @@ GameLib.Event.Subscribe(
this.clouds = [];
this.cloudTime = 0;
this.currentSnailPosition.z = this.snail.position.z;
/**