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

beta.r3js.org
-=yb4f310 2018-03-09 15:14:42 +01:00
parent ec7827892b
commit 51dcb7c6b8
1 changed files with 43 additions and 19 deletions

View File

@ -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