From 51dcb7c6b8828f55baabf3f053cbdffaf2c3a648 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 9 Mar 2018 15:14:42 +0100 Subject: [PATCH] Update: CC - SnailRunner - Entity Loaded (78gnds8jrj.js) 565 bytes modified --- 78gnds8jrj.js | 62 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/78gnds8jrj.js b/78gnds8jrj.js index aeb2c7d..3313046 100644 --- a/78gnds8jrj.js +++ b/78gnds8jrj.js @@ -25,38 +25,52 @@ this.treesRight = GameLib.EntityManager.Instance.findComponentById('oag0yr1rav') this.road = GameLib.EntityManager.Instance.findComponentById('4furha3wst'); /** - * Road Sections + * Road Sections and Clouds */ -this.sections = []; +this.sections = []; +this.clouds = []; /** * Camera */ this.camera = GameLib.EntityManager.Instance.findComponentById('hd8dsn7o4c'); - -var cloneLeft = this.treesLeft.clone(); -var cloneRoad = this.road.clone(); -var cloneRight = this.treesRight.clone(); - -for (var i = 0; i < 17; i++) { +GameLib.CustomCode.prototype.spawnCloud = function() { + var cloud = this.cloud.clone(); + + this.cloud.position.x = -155; + this.cloud.position.z = (Math.random() * 25) - 12.5; + this.cloud.updateInstance('position'); + + this.clouds.push(cloud); +}.bind(this) +GameLib.CustomCode.prototype.spawnRoadSections = function() { + + var cloneLeft = this.treesLeft.clone(); + var cloneRoad = this.road.clone(); + var cloneRight = this.treesRight.clone(); + + for (var i = 0; i < 17; i++) { + + this.sections.push({ + left : cloneLeft, + road : cloneRoad, + right : cloneRight + }) + + cloneLeft = cloneLeft.clone(); + cloneRoad = cloneRoad.clone(); + cloneRight = cloneRight.clone(); + } + this.sections.push({ left : cloneLeft, road : cloneRoad, right : cloneRight }) - - cloneLeft = cloneLeft.clone(); - cloneRoad = cloneRoad.clone(); - cloneRight = cloneRight.clone(); -} -this.sections.push({ - left : cloneLeft, - road : cloneRoad, - right : cloneRight -}) +}.bind(this) GameLib.Event.Subscribe( GameLib.Event.GAME_START, @@ -68,6 +82,16 @@ GameLib.Event.Subscribe( this.speed = 0; this.speedUp = false; + this.clouds.map( + function(cloud) { + cloud.geometry = null; + cloud.materials = null; + cloud.remove(); + } + ); + + this.clouds = []; + /** * Activate our custom code components */ @@ -81,6 +105,6 @@ GameLib.Event.Subscribe( }.bind(this) ); - +this.spawnRoadSections(); //@ sourceURL=entityLoaded.js \ No newline at end of file