From 7cd87f9cbbb63105b97ce82db7973e96f262c99d Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 9 Mar 2018 18:52:08 +0100 Subject: [PATCH] Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 28 bytes modified --- 78gnds8jrj.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/78gnds8jrj.js b/78gnds8jrj.js index 982488f..00e8491 100644 --- a/78gnds8jrj.js +++ b/78gnds8jrj.js @@ -35,6 +35,7 @@ this.maxSpeed = 50; this.speedPercentage = 0; this.cloudTime = 0; +this.time = 0; /** * Camera settings y = height, z = FOV @@ -57,16 +58,6 @@ this.camera = GameLib.EntityManager.Instance.findComponentById('hd8dsn7o4c'); this.raycaster = GameLib.EntityManager.Instance.findComponentById('h3yxd73sz7'); this.mouse = GameLib.EntityManager.Instance.findComponentById('eriv6mcw8k'); -GameLib.CustomCode.prototype.spawnCloud = function() { - var cloud = this.cloud.clone(); - - this.cloud.position.x = -155; - this.cloud.position.z = Math.sin(this.cloudTime) * 30; - this.cloud.updateInstance('position'); - - this.clouds.push(cloud); -}.bind(this) - GameLib.CustomCode.prototype.spawnRoadSections = function() { var cloneLeft = this.treesLeft.clone(); @@ -94,6 +85,16 @@ GameLib.CustomCode.prototype.spawnRoadSections = function() { }.bind(this) +GameLib.CustomCode.prototype.spawnCloud = function() { + var cloud = this.cloud.clone(); + + this.cloud.position.x = -155; + this.cloud.position.z = Math.sin(this.time / 10) * 30; + this.cloud.updateInstance('position'); + + this.clouds.push(cloud); +}.bind(this) + GameLib.CustomCode.prototype.advanceClouds = function(delta) { var diff = delta * this.speed; @@ -129,7 +130,7 @@ GameLib.CustomCode.prototype.advanceClouds = function(delta) { this.cloudTime += diff; - if (this.cloudTime > Math.PI * 2) { + if (this.cloudTime > 10) { this.spawnCloud(); this.cloudTime = 0; } @@ -256,7 +257,8 @@ GameLib.Event.Subscribe( this.snail.position.z = 0; this.speed = 0; this.speedUp = false; - + this.time = 0; + this.movement = { left : false, right : false,