diff --git a/dywmtohrda.js b/dywmtohrda.js index dd0f2ed..a55afce 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -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,