Update: CC - Before Render - Moorcow (9l6o7974qx.js) 20 bytes modified

beta.r3js.org
-=yb4f310 2017-11-06 23:57:44 +01:00
parent e7c95c60ca
commit cc9486e355
1 changed files with 18 additions and 16 deletions

View File

@ -30,64 +30,66 @@ if (
this.nextSpawnTime = this.getNextSpawnTime(); this.nextSpawnTime = this.getNextSpawnTime();
this.spawnEnemy = function() { this.spawnEnemy = function() {
var enemyType = Math.floor((Math.random() * 5) + 1); var enemyType = Math.floor((Math.random() * 5) + 1);
var y = Math.floor((Math.random() * 40) + 2); var y = Math.floor((Math.random() * 40) + 2);
var apiBox = new GameLib.D3.API.Mesh(); var apiBox = new GameLib.D3.API.Mesh();
apiBox.materials = [this.boxMaterial]; apiBox.materials = [this.boxMaterial];
var box = GameLib.EntityManager.Instance.findComponentById('3upawmhh8j').clone();
var box = GameLib.EntityManager.Instance.findComponentById('3upawmhh8j');
var velocity = null; var velocity = null;
var position = {x : 0, y: y, z :0}; var position = {x : 0, y: y, z :0};
var enemy = { var enemy = {
mesh : box mesh : box
}; };
if (enemyType === 1) { if (enemyType === 1) {
position.x = -500; position.x = -500;
velocity = {x:1,y:0,z:0}; velocity = {x:1,y:0,z:0};
} }
if (enemyType === 2) { if (enemyType === 2) {
position.x = 500; position.x = 500;
velocity = {x:-1,y:0,z:0}; velocity = {x:-1,y:0,z:0};
} }
if (enemyType === 3) { if (enemyType === 3) {
position.x = -500; position.x = -500;
position.z = -500; position.z = -500;
velocity = {x:1,y:0,z:1}; velocity = {x:1,y:0,z:1};
} }
if (enemyType === 4) { if (enemyType === 4) {
position.x = 500; position.x = 500;
position.z = -500; position.z = -500;
velocity = {x:-1,y:0,z:1}; velocity = {x:-1,y:0,z:1};
} }
if (enemyType === 5) { if (enemyType === 5) {
position.x = 0; position.x = 0;
position.z = -500; position.z = -500;
velocity = {x:0,y:0,z:1}; velocity = {x:0,y:0,z:1};
} }
enemy.mesh.position.x = position.x; enemy.mesh.position.x = position.x;
enemy.mesh.position.y = position.y; enemy.mesh.position.y = position.y;
enemy.mesh.position.z = position.z; enemy.mesh.position.z = position.z;
enemy.mesh.updateInstancePosition(); enemy.mesh.updateInstancePosition();
enemy.velocity = velocity; enemy.velocity = velocity;
enemy.lifeTime = 0; enemy.lifeTime = 0;
enemy.life = 50; enemy.life = 50;
this.enemies.push(enemy); this.enemies.push(enemy);
} }
} }