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