From 8506c64d047e57fcbf198d6ac500d6c483e80382 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 9 Mar 2018 18:39:00 +0100 Subject: [PATCH] Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 365 bytes modified --- 78gnds8jrj.js | 62 +++++++++++++++++++++------------------------------ 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/78gnds8jrj.js b/78gnds8jrj.js index a266326..79dfe19 100644 --- a/78gnds8jrj.js +++ b/78gnds8jrj.js @@ -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; /**