Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 505 bytes modified

beta.r3js.org
-=yb4f310 2017-11-02 12:02:01 +01:00
parent 22ae950b70
commit 4d131961bb
1 changed files with 25 additions and 4 deletions

View File

@ -48,6 +48,9 @@ if (
this.scene = GameLib.EntityManager.Instance.findComponentById('fd2be8y1c8');
this.sceneCrosshair = GameLib.EntityManager.Instance.findComponentById('7xkcp6x9pf');
this.meshCrosshair = GameLib.EntityManager.Instance.findComponentById('oxpg88pgzv');
this.meshFireBall = GameLib.EntityManager.Instance.findComponentById('zmcwqlym5y');
this.flames = [];
for (var i = 0; i < 100; i++) {
var tree = this.tree.clone();
@ -78,7 +81,7 @@ if (
var box = new GameLib.D3.Mesh.Box(this.graphics, apiBox, 4,4,4);
var velocity = null;
var position = {x : 0, y: y, z :0};
var enemy = {
@ -136,10 +139,17 @@ if (this.spawnTime > this.nextSpawnTime) {
this.spawnEnemy();
}
this.flames.map(
function(flame) {
flame.mesh.position.add(flame.direction);
flame.mesh.updateInstancePosition();
}
);
if (this.spawningBullets === true) {
if (this.spawnBulletTime === 0) {
var material = new THREE.LineBasicMaterial({
color: 0xff0000,
linewidth: 5
@ -153,11 +163,22 @@ if (this.spawningBullets === true) {
var start = new THREE.Vector3(0,0,0.5);
start.unproject(this.camera.instance);
var end = direction.multiplyScalar(1000);
var end = direction.clone().multiplyScalar(1000);
console.log('start: ', start);
console.log('end: ', end);
var flameMesh = this.meshFireBall.clone();
flameMesh.position.x = start.x;
flameMesh.position.y = start.y;
flameMesh.position.z = start.z;
flameMesh.updateInstancePosition();
this.flames.push({
mesh : flameMesh,
direction: direction
});
var geometry = new THREE.Geometry();
geometry.vertices.push(
start,