From cc9486e3558a8e93616599648ceafdd7becf4204 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Mon, 6 Nov 2017 23:57:44 +0100 Subject: [PATCH] Update: CC - Before Render - Moorcow (9l6o7974qx.js) 20 bytes modified --- 9l6o7974qx.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/9l6o7974qx.js b/9l6o7974qx.js index 8bc69f6..c4c25a7 100644 --- a/9l6o7974qx.js +++ b/9l6o7974qx.js @@ -30,64 +30,66 @@ if ( this.nextSpawnTime = this.getNextSpawnTime(); - this.spawnEnemy = function() { + this.spawnEnemy = function() { var enemyType = Math.floor((Math.random() * 5) + 1); - + var y = Math.floor((Math.random() * 40) + 2); - + var apiBox = new GameLib.D3.API.Mesh(); - + apiBox.materials = [this.boxMaterial]; + + var box = GameLib.EntityManager.Instance.findComponentById('3upawmhh8j').clone(); + - var box = GameLib.EntityManager.Instance.findComponentById('3upawmhh8j'); var velocity = null; - + var position = {x : 0, y: y, z :0}; - + var enemy = { mesh : box }; - + if (enemyType === 1) { position.x = -500; velocity = {x:1,y:0,z:0}; } - + if (enemyType === 2) { position.x = 500; velocity = {x:-1,y:0,z:0}; } - + if (enemyType === 3) { position.x = -500; position.z = -500; velocity = {x:1,y:0,z:1}; } - + if (enemyType === 4) { position.x = 500; position.z = -500; velocity = {x:-1,y:0,z:1}; } - + if (enemyType === 5) { position.x = 0; position.z = -500; velocity = {x:0,y:0,z:1}; } - - + + enemy.mesh.position.x = position.x; enemy.mesh.position.y = position.y; enemy.mesh.position.z = position.z; enemy.mesh.updateInstancePosition(); - + enemy.velocity = velocity; enemy.lifeTime = 0; enemy.life = 50; - + this.enemies.push(enemy); } }