1. <things version="1">
  2.  
  3. <template name="Enemy">
  4.  
  5. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  6.  
  7. <canMove>true</canMove>
  8. <canSleep>false</canSleep>
  9. <canRotate>false</canRotate>
  10. <manager componentReference="SpatialDB"/>
  11.  
  12. <collidesWithTypes childType="String">
  13. <_0>Player</_0>
  14. <_1>PlayerBullet</_1>
  15. </collidesWithTypes>
  16.  
  17. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  18. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  19. <vertices childType="flash.geom.Point">
  20. <_0 type="">
  21. <x>-1</x>
  22. <y>-1</y>
  23. </_0>
  24. <_1 type="">
  25. <x>1</x>
  26. <y>-1</y>
  27. </_1>
  28. <_2 type="">
  29. <x>1</x>
  30. <y>1</y>
  31. </_2>
  32. <_3 type="">
  33. <x>-1</x>
  34. <y>1</y>
  35. </_3>
  36. </vertices>
  37. </_0>
  38. </collisionShapes>
  39.  
  40. <collisionType childType="String">
  41. <_0>Enemy</_0>
  42. <_1>Renderable</_1>
  43. </collisionType>
  44.  
  45. <size type="">
  46. <x>16</x>
  47. <y>16</y>
  48. </size>
  49.  
  50. </component>
  51.  
  52. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  53. <positionReference>@Spatial.position</positionReference>
  54. <rotationReference>@Spatial.rotation</rotationReference>
  55. <sizeReference>@Spatial.size</sizeReference>
  56. </component>
  57.  
  58. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  59. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  60. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  61. <defaultAnimation>Idle</defaultAnimation>
  62. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  63. <Idle type="">
  64. <frameRate>4</frameRate>
  65. <maxFrameDelay>250</maxFrameDelay>
  66. <loop>true</loop>
  67. <spriteSheet componentReference="Enemy1SpriteSheet"/>
  68. </Idle>
  69. </animations>
  70. </component>
  71.  
  72. </template>
  73.  
  74. <template name="Player">
  75.  
  76. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  77.  
  78. <canMove>true</canMove>
  79. <canSleep>false</canSleep>
  80. <canRotate>false</canRotate>
  81. <manager componentReference="SpatialDB"/>
  82.  
  83. <collidesWithTypes childType="String">
  84. <_0>Enemy</_0>
  85. </collidesWithTypes>
  86.  
  87. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  88. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  89. <vertices childType="flash.geom.Point">
  90. <_0 type="">
  91. <x>-1</x>
  92. <y>-1</y>
  93. </_0>
  94. <_1 type="">
  95. <x>1</x>
  96. <y>-1</y>
  97. </_1>
  98. <_2 type="">
  99. <x>1</x>
  100. <y>1</y>
  101. </_2>
  102. <_3 type="">
  103. <x>-1</x>
  104. <y>1</y>
  105. </_3>
  106. </vertices>
  107. </_0>
  108. </collisionShapes>
  109.  
  110. <collisionType childType="String">
  111. <_0>Player</_0>
  112. <_1>Renderable</_1>
  113. </collisionType>
  114.  
  115. <position>
  116. <x>240</x>
  117. <y>352</y>
  118. </position>
  119.  
  120. <size type="">
  121. <x>28</x>
  122. <y>16</y>
  123. </size>
  124.  
  125. </component>
  126.  
  127. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  128. <positionReference>@Spatial.position</positionReference>
  129. <rotationReference>@Spatial.rotation</rotationReference>
  130. <sizeReference>@Spatial.size</sizeReference>
  131. <spriteSheet componentReference="PlayerSpriteSheet"/>
  132. </component>
  133.  
  134. <component type="PlayerControllerComponent" name="PlayerController">
  135. <velocityReference>@Spatial.linearVelocity</velocityReference>
  136. <positionReference>@Spatial.position</positionReference>
  137. <screenWidth>480</screenWidth>
  138. <bulletEntityName>PlayerBullet</bulletEntityName>
  139. </component>
  140.  
  141. </template>
  142.  
  143. <template name="Bullet">
  144.  
  145. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  146.  
  147. <canMove>true</canMove>
  148. <canSleep>false</canSleep>
  149. <canRotate>false</canRotate>
  150. <manager componentReference="SpatialDB"/>
  151.  
  152. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  153. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  154. <vertices childType="flash.geom.Point">
  155. <_0 type="">
  156. <x>-1</x>
  157. <y>-1</y>
  158. </_0>
  159. <_1 type="">
  160. <x>1</x>
  161. <y>-1</y>
  162. </_1>
  163. <_2 type="">
  164. <x>1</x>
  165. <y>1</y>
  166. </_2>
  167. <_3 type="">
  168. <x>-1</x>
  169. <y>1</y>
  170. </_3>
  171. </vertices>
  172. </_0>
  173. </collisionShapes>
  174.  
  175. <size type="">
  176. <x>6</x>
  177. <y>14</y>
  178. </size>
  179.  
  180. </component>
  181.  
  182. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  183. <positionReference>@Spatial.position</positionReference>
  184. <rotationReference>@Spatial.rotation</rotationReference>
  185. <sizeReference>@Spatial.size</sizeReference>
  186. </component>
  187.  
  188. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  189. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  190. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  191. <defaultAnimation>Idle</defaultAnimation>
  192. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  193. <Idle type="">
  194. <frameRate>6</frameRate>
  195. <maxFrameDelay>1000</maxFrameDelay>
  196. <loop>true</loop>
  197. <spriteSheet componentReference="BulletSpriteSheet"/>
  198. </Idle>
  199. </animations>
  200. </component>
  201.  
  202. <component type="DestroyIfOffScreenComponent" name="DestroyIfOffScreen">
  203. <positionReference>@Spatial.position</positionReference>
  204. <screenWidth>480</screenWidth>
  205. <screenHeight>384</screenHeight>
  206. </component>
  207.  
  208. <component type="DamageOnContactConponent" name="DamageOnContact">
  209. <damage>1</damage>
  210. </component>
  211.  
  212. </template>
  213.  
  214. <template name="PlayerBullet" template="Bullet">
  215.  
  216. <component name="Spatial">
  217.  
  218. <collisionType childType="String">
  219. <_0>Renderable</_0>
  220. <_0>PlayerBullet</_0>
  221. </collisionType>
  222.  
  223. <collidesWithTypes childType="String">
  224. <_0>Enemy</_0>
  225. </collidesWithTypes>
  226.  
  227. </component>
  228.  
  229. </template>
  230.  
  231. </things>