From 6f270a9333ad1f65cf31a272b82f0118c8269a0c Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 01/13] Initial Commit: Custom Code - BK Flame - Before Render (dywmtohrda.js) --- dywmtohrda.js | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 dywmtohrda.js diff --git a/dywmtohrda.js b/dywmtohrda.js new file mode 100644 index 0000000..086d994 --- /dev/null +++ b/dywmtohrda.js @@ -0,0 +1,208 @@ +if (GameLib.Utils.UndefinedOrNull(this.entityLoaded)) { + + /** + * This component is not ready to run + */ + return; +} + +if ( + GameLib.Utils.UndefinedOrNull(this.totalTime) || + GameLib.Utils.UndefinedOrNull(this.spawnTime) || + GameLib.Utils.UndefinedOrNull(this.spawnBulletFrequency) || + GameLib.Utils.UndefinedOrNull(this.camera) || + GameLib.Utils.UndefinedOrNull(this.scene) || + GameLib.Utils.UndefinedOrNull(this.sceneCrosshair) + // true +) { + + /** + * This component is initializing - set the total time to 0 + */ + this.totalTime = 0; + this.spawnTime = 0; + this.spawnBulletFrequency = 0.1; + + this.enemies = []; + + GameLib.Event.Emit( + GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, + null, + function(graphics) { + this.graphics = graphics + }.bind(this) + ); + + this.getNextSpawnTime = function() { + return GameLib.Utils.GetRandomIntInclusive( + GameLib.D3.CustomCode.MIN_SPAWN_TIME, + GameLib.D3.CustomCode.MAX_SPAWN_TIME + ); + } + + this.boxMaterial = GameLib.EntityManager.Instance.findComponentById('dsaua5t19a'); + + this.tree = GameLib.EntityManager.Instance.findComponentById('fcj62ukx5s'); + + this.camera = GameLib.EntityManager.Instance.findComponentById('yv62w8sx9r'); + this.scene = GameLib.EntityManager.Instance.findComponentById('fd2be8y1c8'); + this.sceneCrosshair = GameLib.EntityManager.Instance.findComponentById('7xkcp6x9pf'); + this.meshCrosshair = GameLib.EntityManager.Instance.findComponentById('oxpg88pgzv'); + + for (var i = 0; i < 100; i++) { + var tree = this.tree.clone(); + tree.position.x = Math.floor(Math.random() * 1000) - 500; + tree.position.y = Math.floor(Math.random() * 60) - 30; + tree.position.z = Math.floor(Math.random() * 1000) - 500; + tree.updateInstance(); + } + + this.tree.position.x = Math.floor(Math.random() * 1000) - 500; + this.tree.position.y = Math.floor(Math.random() * 60) - 30; + this.tree.position.z = Math.floor(Math.random() * 1000) - 500; + + this.tree.updateInstance(); + + this.nextSpawnTime = this.getNextSpawnTime(); +} + + 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 = new GameLib.D3.Mesh.Box(this.graphics, apiBox, 4,4,4); + + 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); + } + +this.totalTime += data.delta; +this.spawnTime += data.delta; + +if (this.spawnTime > this.nextSpawnTime) { + this.nextSpawnTime = Math.floor((Math.random() * 1) + 1); + this.spawnTime = 0; + this.spawnEnemy(); +} + +if (this.spawningBullets === true) { + + if (this.spawnBulletTime === 0) { + + var material = new THREE.LineBasicMaterial({ + color: 0xff0000, + linewidth: 5 + }); + + var position = this.camera.lookAt.instance.clone(); + var origin = this.camera.position.instance.clone(); + + var mInverse = new THREE.Matrix4().getInverse( this.sceneCrosshair.instance.matrixWorld ); + + position.applyMatrix4( mInverse ); + + var geometry = new THREE.Geometry(); + geometry.vertices.push( + new THREE.Vector3( + this.camera.position.x, + this.camera.position.y, + 0 + ), + position + ); + + var line = new THREE.Line( geometry, material ); + this.scene.instance.add( line ); + + } + + this.spawnBulletTime += data.delta; + + if (this.spawnBulletTime > this.spawnBulletFrequency) { + this.spawnBulletTime = 0; + } + +} + +this.scene.instance.children.map( + function(child) { + if (child instanceof THREE.Line) { + child.position.y -= 0.01; + } + } +); + +//this.entityLoaded.updateMaterialRusted(this.totalTime); + +this.enemies = this.enemies.reduce( + function(result, enemy) { + enemy.mesh.position.add(enemy.velocity); + enemy.mesh.updateInstancePosition(); + enemy.lifeTime += data.delta; + if (enemy.lifeTime > enemy.life) { + GameLib.Event.Emit( + GameLib.Event.REMOVE_COMPONENT, + { + component : enemy.mesh + } + ); + } else { + result.push(enemy); + } + return result; + }, + [] +); + +return null; +//# sourceURL=beforeRender.js \ No newline at end of file From 91dc67a6a4b49ccc217e541cbe9390635c2ac1ae Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 06/13] Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 4 bytes modified --- dywmtohrda.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dywmtohrda.js b/dywmtohrda.js index 086d994..5621c31 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -63,6 +63,8 @@ if ( this.tree.updateInstance(); + + this.nextSpawnTime = this.getNextSpawnTime(); } From ee458deeb160f78c944541f9a371ac21ac7b8f90 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 07/13] Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 3 bytes modified --- dywmtohrda.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dywmtohrda.js b/dywmtohrda.js index 5621c31..1f64e35 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -62,9 +62,7 @@ if ( this.tree.position.z = Math.floor(Math.random() * 1000) - 500; this.tree.updateInstance(); - - - + this.nextSpawnTime = this.getNextSpawnTime(); } From 21422d4b6b73eece8606559e2e5cce26005054e1 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 08/13] Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 2 bytes modified --- dywmtohrda.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dywmtohrda.js b/dywmtohrda.js index 1f64e35..8d6e104 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -40,6 +40,7 @@ if ( ); } + this.boxMaterial = GameLib.EntityManager.Instance.findComponentById('dsaua5t19a'); this.tree = GameLib.EntityManager.Instance.findComponentById('fcj62ukx5s'); From 64643c5b8d9dba2fe8b04087da65a19259869fc4 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 09/13] Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 1 bytes modified --- dywmtohrda.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dywmtohrda.js b/dywmtohrda.js index 8d6e104..99399c5 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -39,7 +39,6 @@ if ( GameLib.D3.CustomCode.MAX_SPAWN_TIME ); } - this.boxMaterial = GameLib.EntityManager.Instance.findComponentById('dsaua5t19a'); From 01dfd0c16b6b5e34e6eeadbf8c35ccfcaffddd9d Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 10/13] Update: Custom Code - BK Flame - Before Render (dywmtohrda.js) 2 bytes modified --- dywmtohrda.js | 1 + 1 file changed, 1 insertion(+) diff --git a/dywmtohrda.js b/dywmtohrda.js index 99399c5..79001e2 100644 --- a/dywmtohrda.js +++ b/dywmtohrda.js @@ -40,6 +40,7 @@ if ( ); } + this.boxMaterial = GameLib.EntityManager.Instance.findComponentById('dsaua5t19a'); this.tree = GameLib.EntityManager.Instance.findComponentById('fcj62ukx5s'); From 83d83c2b716f4034a3743c924634295352461361 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 11/13] Initial Commit: Custom Code - BK Flame - Entity Loaded (mccud019kb.js) --- mccud019kb.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mccud019kb.js diff --git a/mccud019kb.js b/mccud019kb.js new file mode 100644 index 0000000..ce161a2 --- /dev/null +++ b/mccud019kb.js @@ -0,0 +1,41 @@ +if (this.parentEntity === data.entity) { + console.log('my entity loaded :)'); +} else { + return; +} + +this.enemies = []; + +/** + * Min and max spawn time is in seconds + */ +GameLib.D3.CustomCode.MIN_SPAWN_TIME = 1; +GameLib.D3.CustomCode.MAX_SPAWN_TIME = 4; + +this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); +//this.materialRusted = GameLib.EntityManager.Instance.findComponentById('0mrd2dx5np'); + +GameLib.Event.Emit( + GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, + null, + function(graphics) { + this.graphics = graphics + }.bind(this) +); + +if ( + !this.beforeRender +) { + console.error('components not available at runtime', this); +} + +/** + * Updates the displacement scale of materialRusted + */ +//this.updateMaterialRusted = function(totalTime) { +// this.materialRusted.displacementScale = Math.sin(totalTime); +// this.materialRusted.updateInstance(); +//} + +return null; +//# sourceURL=entityLoaded.js \ No newline at end of file From 664cc4dc45a4b853a13a81fd809939eeb4e86b78 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 12/13] Initial Commit: Custom Code - BK Flame - Mouse Wheel (ot5qabk55a.js) --- mccud019kb.js | 41 ----------------------------------------- n3ehhvglar.js | 8 ++++++++ ot5qabk55a.js | 13 +++++++++++++ 3 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 mccud019kb.js create mode 100644 n3ehhvglar.js create mode 100644 ot5qabk55a.js diff --git a/mccud019kb.js b/mccud019kb.js deleted file mode 100644 index ce161a2..0000000 --- a/mccud019kb.js +++ /dev/null @@ -1,41 +0,0 @@ -if (this.parentEntity === data.entity) { - console.log('my entity loaded :)'); -} else { - return; -} - -this.enemies = []; - -/** - * Min and max spawn time is in seconds - */ -GameLib.D3.CustomCode.MIN_SPAWN_TIME = 1; -GameLib.D3.CustomCode.MAX_SPAWN_TIME = 4; - -this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); -//this.materialRusted = GameLib.EntityManager.Instance.findComponentById('0mrd2dx5np'); - -GameLib.Event.Emit( - GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, - null, - function(graphics) { - this.graphics = graphics - }.bind(this) -); - -if ( - !this.beforeRender -) { - console.error('components not available at runtime', this); -} - -/** - * Updates the displacement scale of materialRusted - */ -//this.updateMaterialRusted = function(totalTime) { -// this.materialRusted.displacementScale = Math.sin(totalTime); -// this.materialRusted.updateInstance(); -//} - -return null; -//# sourceURL=entityLoaded.js \ No newline at end of file diff --git a/n3ehhvglar.js b/n3ehhvglar.js new file mode 100644 index 0000000..1072394 --- /dev/null +++ b/n3ehhvglar.js @@ -0,0 +1,8 @@ +this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); +this.entityLoaded = GameLib.EntityManager.Instance.findComponentById('mccud019kb'); + +this.beforeRender.entityLoaded = this.entityLoaded; + +return null; + +//@ sourceURL=gameStart.js \ No newline at end of file diff --git a/ot5qabk55a.js b/ot5qabk55a.js new file mode 100644 index 0000000..5e872b3 --- /dev/null +++ b/ot5qabk55a.js @@ -0,0 +1,13 @@ +if (GameLib.Utils.UndefinedOrNull(this.camera)) { + this.camera = GameLib.EntityManager.Instance.findComponentById('yv62w8sx9r'); +} + +if (data.event.deltaY < 0 && this.camera.fov > 30) { + this.camera.fov -= 30; + this.camera.updateInstance(); +} else if (data.event.deltaY > 0 && this.camera.fov < 90) { + this.camera.fov += 30; + this.camera.updateInstance(); +} + +//@ sourceURL=mouseWheel.js \ No newline at end of file From b8d881eb60991e937ba807512c4800b295b05cd3 Mon Sep 17 00:00:00 2001 From: -=yb4f3410 Date: Thu, 29 Nov 1973 22:33:09 +0100 Subject: [PATCH 13/13] Initial Commit: Custom Code - BK Flame - Entity Loaded (mccud019kb.js) --- 1cs8fm87ty.js | 28 ++++++++++++++++++++++++++++ mccud019kb.js | 41 +++++++++++++++++++++++++++++++++++++++++ n3ehhvglar.js | 8 -------- ongcnzdgae.js | 10 ++++++++++ ot5qabk55a.js | 13 ------------- 5 files changed, 79 insertions(+), 21 deletions(-) create mode 100644 1cs8fm87ty.js create mode 100644 mccud019kb.js delete mode 100644 n3ehhvglar.js create mode 100644 ongcnzdgae.js delete mode 100644 ot5qabk55a.js diff --git a/1cs8fm87ty.js b/1cs8fm87ty.js new file mode 100644 index 0000000..6c559ef --- /dev/null +++ b/1cs8fm87ty.js @@ -0,0 +1,28 @@ +//console.log(data); + +this.camera = GameLib.EntityManager.Instance.findComponentById('yv62w8sx9r'); + +var vector = new THREE.Vector3(); + +vector.set( + ( event.clientX / window.innerWidth ) * 2 - 1, + - ( event.clientY / window.innerHeight ) * 2 + 1, + 0.5 ); + +vector.unproject( this.camera.instance ); + +vector.x = -1 * ((window.innerWidth / 2) - (data.event.clientX)); +vector.y = 1 * ((window.innerHeight / 2) - (data.event.clientY)); +vector.z = 0; + +this.camera.lookAt.x = vector.x; +this.camera.lookAt.y = vector.y; +this.camera.lookAt.z = vector.z; + +this.camera.updateInstance(); + +//console.log(vector.x); + +return null; + +//@ sourceURL=mouseMove.js \ No newline at end of file diff --git a/mccud019kb.js b/mccud019kb.js new file mode 100644 index 0000000..ce161a2 --- /dev/null +++ b/mccud019kb.js @@ -0,0 +1,41 @@ +if (this.parentEntity === data.entity) { + console.log('my entity loaded :)'); +} else { + return; +} + +this.enemies = []; + +/** + * Min and max spawn time is in seconds + */ +GameLib.D3.CustomCode.MIN_SPAWN_TIME = 1; +GameLib.D3.CustomCode.MAX_SPAWN_TIME = 4; + +this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); +//this.materialRusted = GameLib.EntityManager.Instance.findComponentById('0mrd2dx5np'); + +GameLib.Event.Emit( + GameLib.Event.GET_GRAPHICS_IMPLEMENTATION, + null, + function(graphics) { + this.graphics = graphics + }.bind(this) +); + +if ( + !this.beforeRender +) { + console.error('components not available at runtime', this); +} + +/** + * Updates the displacement scale of materialRusted + */ +//this.updateMaterialRusted = function(totalTime) { +// this.materialRusted.displacementScale = Math.sin(totalTime); +// this.materialRusted.updateInstance(); +//} + +return null; +//# sourceURL=entityLoaded.js \ No newline at end of file diff --git a/n3ehhvglar.js b/n3ehhvglar.js deleted file mode 100644 index 1072394..0000000 --- a/n3ehhvglar.js +++ /dev/null @@ -1,8 +0,0 @@ -this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); -this.entityLoaded = GameLib.EntityManager.Instance.findComponentById('mccud019kb'); - -this.beforeRender.entityLoaded = this.entityLoaded; - -return null; - -//@ sourceURL=gameStart.js \ No newline at end of file diff --git a/ongcnzdgae.js b/ongcnzdgae.js new file mode 100644 index 0000000..ef15bba --- /dev/null +++ b/ongcnzdgae.js @@ -0,0 +1,10 @@ +this.stopSpawnBullet = function() { + this.beforeRender = GameLib.EntityManager.Instance.findComponentById('dywmtohrda'); + this.beforeRender.spawningBullets = false; +} + +this.stopSpawnBullet(); + +return null; + +//@ sourceURL=mouseUp.js \ No newline at end of file diff --git a/ot5qabk55a.js b/ot5qabk55a.js deleted file mode 100644 index 5e872b3..0000000 --- a/ot5qabk55a.js +++ /dev/null @@ -1,13 +0,0 @@ -if (GameLib.Utils.UndefinedOrNull(this.camera)) { - this.camera = GameLib.EntityManager.Instance.findComponentById('yv62w8sx9r'); -} - -if (data.event.deltaY < 0 && this.camera.fov > 30) { - this.camera.fov -= 30; - this.camera.updateInstance(); -} else if (data.event.deltaY > 0 && this.camera.fov < 90) { - this.camera.fov += 30; - this.camera.updateInstance(); -} - -//@ sourceURL=mouseWheel.js \ No newline at end of file