arkanoid.app.json 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. {
  2. "metadata": {
  3. "type": "App"
  4. },
  5. "project": {
  6. "shadows": true,
  7. "editable": true,
  8. "vr": false
  9. },
  10. "camera": {
  11. "metadata": {
  12. "version": 4.4,
  13. "type": "Object",
  14. "generator": "Object3D.toJSON"
  15. },
  16. "object": {
  17. "uuid": "E41E9F54-8B31-4D1F-8D09-AF5E802E9A22",
  18. "type": "PerspectiveCamera",
  19. "name": "Camera",
  20. "matrix": [0.9392361044883728,-2.8092810300250903e-9,-0.3432718515396118,0,-0.14778217673301697,0.902585506439209,-0.404351145029068,0,0.3098321855068207,0.43051064014434814,0.847740888595581,0,142.32125854492188,202.75485229492188,389.40936279296875,1],
  21. "fov": 50,
  22. "aspect": 1.536388140161725,
  23. "near": 0.1,
  24. "far": 100000
  25. }
  26. },
  27. "scene": {
  28. "metadata": {
  29. "version": 4.4,
  30. "type": "Object",
  31. "generator": "Object3D.toJSON"
  32. },
  33. "geometries": [
  34. {
  35. "uuid": "8F05A1F2-3877-478B-8DFC-F572AC61AB3A",
  36. "type": "PlaneGeometry",
  37. "width": 300,
  38. "height": 400,
  39. "widthSegments": 1,
  40. "heightSegments": 1
  41. },
  42. {
  43. "uuid": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5",
  44. "type": "CylinderGeometry",
  45. "radiusTop": 5,
  46. "radiusBottom": 5,
  47. "height": 20,
  48. "radialSegments": 32,
  49. "heightSegments": 1,
  50. "openEnded": false
  51. },
  52. {
  53. "uuid": "7149652B-DBD7-4CB7-A600-27A9AC005C95",
  54. "type": "BoxGeometry",
  55. "width": 20,
  56. "height": 10,
  57. "depth": 10,
  58. "widthSegments": 1,
  59. "heightSegments": 1,
  60. "depthSegments": 1
  61. },
  62. {
  63. "uuid": "CABCC711-1331-4D4C-9FF6-409299F10C68",
  64. "type": "SphereGeometry",
  65. "radius": 5,
  66. "widthSegments": 32,
  67. "heightSegments": 16,
  68. "phiStart": 0,
  69. "phiLength": 6.28,
  70. "thetaStart": 0,
  71. "thetaLength": 3.14
  72. },
  73. {
  74. "uuid": "EFBF641D-F092-462E-B7FB-0BFAD1591EFC",
  75. "type": "BoxGeometry",
  76. "width": 20,
  77. "height": 10,
  78. "depth": 10,
  79. "widthSegments": 1,
  80. "heightSegments": 1,
  81. "depthSegments": 1
  82. }],
  83. "materials": [
  84. {
  85. "uuid": "2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF",
  86. "type": "MeshPhongMaterial",
  87. "color": 86015,
  88. "emissive": 0,
  89. "specular": 1118481,
  90. "shininess": 30
  91. },
  92. {
  93. "uuid": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655",
  94. "type": "MeshPhongMaterial",
  95. "color": 16777215,
  96. "emissive": 0,
  97. "specular": 1118481,
  98. "shininess": 30
  99. },
  100. {
  101. "uuid": "D98FC4D1-169E-420A-92EA-20E55009A46D",
  102. "type": "MeshBasicMaterial",
  103. "wireframe": true,
  104. "color": 63744
  105. },
  106. {
  107. "uuid": "043B208C-1F83-42C6-802C-E0E35621C27C",
  108. "type": "MeshPhongMaterial",
  109. "color": 16777215,
  110. "emissive": 0,
  111. "specular": 1118481,
  112. "shininess": 30
  113. },
  114. {
  115. "uuid": "40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB",
  116. "type": "MeshBasicMaterial",
  117. "wireframe": true,
  118. "color": 63744
  119. }],
  120. "object": {
  121. "uuid": "31517222-A9A7-4EAF-B5F6-60751C0BABA3",
  122. "type": "Scene",
  123. "name": "Scene",
  124. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
  125. "children": [
  126. {
  127. "uuid": "EBBB1E63-6318-4752-AE2E-440A4E0B3EF3",
  128. "type": "Mesh",
  129. "name": "Ground",
  130. "matrix": [1,0,0,0,0,0.0007960614748299122,-0.9999997019767761,0,0,0.9999997019767761,0.0007960614748299122,0,0,0,0,1],
  131. "geometry": "8F05A1F2-3877-478B-8DFC-F572AC61AB3A",
  132. "material": "2F69AF3A-DDF5-4BBA-87B5-80159F90DDBF"
  133. },
  134. {
  135. "uuid": "6EE2E764-43E0-48E0-85F2-E0C8823C20DC",
  136. "type": "DirectionalLight",
  137. "name": "DirectionalLight 1",
  138. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,100,200,150,1],
  139. "color": 16777215,
  140. "intensity": 1
  141. },
  142. {
  143. "uuid": "38219749-1E67-45F2-AB15-E64BA0940CAD",
  144. "type": "Mesh",
  145. "name": "Brick",
  146. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,5,0,1],
  147. "children": [
  148. {
  149. "uuid": "711A5955-8F17-4A8B-991A-7604D27E6FA0",
  150. "type": "Mesh",
  151. "name": "Cylinder",
  152. "matrix": [0.0007962009985931218,0.0007962677045725286,0.9999995231628418,0,-0.9999997615814209,3.462185702574061e-7,0.0007962677045725286,0,2.210134084634774e-7,-0.9999997615814209,0.0007962008821777999,0,0,0,0,1],
  153. "geometry": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5",
  154. "material": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655"
  155. }],
  156. "geometry": "7149652B-DBD7-4CB7-A600-27A9AC005C95",
  157. "material": "D98FC4D1-169E-420A-92EA-20E55009A46D"
  158. },
  159. {
  160. "uuid": "18FFA67C-F893-4E7A-8A76-8D996DEBE0C6",
  161. "type": "Mesh",
  162. "name": "Ball",
  163. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,5,35.54999923706055,1],
  164. "geometry": "CABCC711-1331-4D4C-9FF6-409299F10C68",
  165. "material": "043B208C-1F83-42C6-802C-E0E35621C27C"
  166. },
  167. {
  168. "uuid": "6D660D49-39B8-40C3-95F6-E4E007AA8D79",
  169. "type": "Mesh",
  170. "name": "Paddle",
  171. "matrix": [2,0,0,0,0,1,0,0,0,0,1,0,0,5,159.5399932861328,1],
  172. "children": [
  173. {
  174. "uuid": "4F5F884C-9E1B-45E6-8F1E-4D538A46D8CB",
  175. "type": "Mesh",
  176. "name": "Cylinder",
  177. "matrix": [0.0007962009985931218,0.0007962677045725286,0.9999995231628418,0,-0.9999997615814209,3.462185702574061e-7,0.0007962677045725286,0,2.210134084634774e-7,-0.9999997615814209,0.0007962008821777999,0,0,0,0,1],
  178. "geometry": "EEDF0A9A-D174-44E4-9C2F-A2F5BB8BE7F5",
  179. "material": "3B9DE64D-E1C8-4C24-9F73-3A9E10E3E655"
  180. }],
  181. "geometry": "EFBF641D-F092-462E-B7FB-0BFAD1591EFC",
  182. "material": "40EC9BDA-91C0-4671-937A-2BCB6DA7EEBB"
  183. },
  184. {
  185. "uuid": "B0BEAF69-8B5D-4D87-ADCA-FDE83A02762D",
  186. "type": "PointLight",
  187. "name": "PointLight 2",
  188. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-116.54356384277344,69.48957061767578,-206.8248291015625,1],
  189. "color": 16777215,
  190. "intensity": 1,
  191. "distance": 0,
  192. "decay": 1
  193. }]
  194. }
  195. },
  196. "scripts": {
  197. "6D660D49-39B8-40C3-95F6-E4E007AA8D79": [
  198. {
  199. "name": "User",
  200. "source": "function mousemove( event ) {\n\n\tthis.position.x = ( event.clientX / player.width ) * 300 - 150;\n\n}\n\n// function update( event ) {}"
  201. }],
  202. "31517222-A9A7-4EAF-B5F6-60751C0BABA3": [
  203. {
  204. "name": "Game Logic",
  205. "source": "var ball = this.getObjectByName( 'Ball' );\n\nvar direction = new THREE.Vector3();\ndirection.x = Math.random() - 0.5;\ndirection.z = - 0.5;\ndirection.normalize();\n\nvar speed = new THREE.Vector3();\n\n//\n\nvar group = new THREE.Group();\nthis.add( group );\n\nvar paddle = this.getObjectByName( 'Paddle' );\npaddle.material.visible = false;\ngroup.add( paddle );\n\nvar brick = this.getObjectByName( 'Brick' );\n\nfor ( var j = 0; j < 8; j ++ ) {\n\n\tvar material = new THREE.MeshPhongMaterial( { color: Math.random() * 0xffffff } );\n\n\tfor ( var i = 0; i < 12; i ++ ) {\n\t\t\n\t\tvar object = brick.clone();\n\t\tobject.position.x = i * 22 - 120;\n\t\tobject.position.z = j * 14 - 120;\n\t\tgroup.add( object );\n\n\t\tvar cylinder = object.getObjectByName( 'Cylinder' );\n\t\tcylinder.material = material;\n\n\t}\n\t\n}\n\nbrick.visible = false;\nbrick.material.visible = false;\n\n//\n\nvar raycaster = new THREE.Raycaster();\n\nfunction update( event ) {\n\t\n\tif ( ball.position.x < - 150 || ball.position.x > 150 ) direction.x = - direction.x;\n\tif ( ball.position.z < - 200 || ball.position.z > 200 ) direction.z = - direction.z;\n\n\tball.position.x = Math.max( - 150, Math.min( 150, ball.position.x ) );\n\tball.position.z = Math.max( - 200, Math.min( 200, ball.position.z ) );\n\t\n\tball.position.add( speed.copy( direction ).multiplyScalar( event.delta / 4 ) );\n\t\n\traycaster.set( ball.position, direction );\n\t\n\tvar intersections = raycaster.intersectObjects( group.children );\n\t\n\tif ( intersections.length > 0 ) {\n\t\n\t\tvar intersection = intersections[ 0 ];\n\t\t\n\t\tif ( intersection.distance < 5 ) {\n\t\t\t\n\t\t\tif ( intersection.object !== paddle ) {\n\n\t\t\t\tgroup.remove( intersection.object );\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tdirection.reflect( intersection.face.normal );\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n}"
  206. }]
  207. }
  208. }