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. <component type="com.pblabs.components.basic.HealthComponent" name="Health">
  73. <maxHealth>1</maxHealth>
  74. </component>
  75.  
  76. <component type="DeathHandlerComponent" name="DeathHandler">
  77. <PositionReference>@Spatial.position</PositionReference>
  78. </component>
  79.  
  80. </template>
  81.  
  82. <template name="Player">
  83.  
  84. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  85.  
  86. <canMove>true</canMove>
  87. <canSleep>false</canSleep>
  88. <canRotate>false</canRotate>
  89. <manager componentReference="SpatialDB"/>
  90.  
  91. <collidesWithTypes childType="String">
  92. <_0>Enemy</_0>
  93. </collidesWithTypes>
  94.  
  95. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  96. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  97. <vertices childType="flash.geom.Point">
  98. <_0 type="">
  99. <x>-1</x>
  100. <y>-1</y>
  101. </_0>
  102. <_1 type="">
  103. <x>1</x>
  104. <y>-1</y>
  105. </_1>
  106. <_2 type="">
  107. <x>1</x>
  108. <y>1</y>
  109. </_2>
  110. <_3 type="">
  111. <x>-1</x>
  112. <y>1</y>
  113. </_3>
  114. </vertices>
  115. </_0>
  116. </collisionShapes>
  117.  
  118. <collisionType childType="String">
  119. <_0>Player</_0>
  120. <_1>Renderable</_1>
  121. </collisionType>
  122.  
  123. <position>
  124. <x>240</x>
  125. <y>352</y>
  126. </position>
  127.  
  128. <size type="">
  129. <x>28</x>
  130. <y>16</y>
  131. </size>
  132.  
  133. </component>
  134.  
  135. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  136. <positionReference>@Spatial.position</positionReference>
  137. <rotationReference>@Spatial.rotation</rotationReference>
  138. <sizeReference>@Spatial.size</sizeReference>
  139. <spriteSheet componentReference="PlayerSpriteSheet"/>
  140. </component>
  141.  
  142. <component type="PlayerControllerComponent" name="PlayerController">
  143. <velocityReference>@Spatial.linearVelocity</velocityReference>
  144. <positionReference>@Spatial.position</positionReference>
  145. <screenWidth>480</screenWidth>
  146. <bulletEntityName>PlayerBullet</bulletEntityName>
  147. </component>
  148.  
  149. </template>
  150.  
  151. <template name="Bullet">
  152.  
  153. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  154.  
  155. <canMove>true</canMove>
  156. <canSleep>false</canSleep>
  157. <canRotate>false</canRotate>
  158. <manager componentReference="SpatialDB"/>
  159.  
  160. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  161. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  162. <vertices childType="flash.geom.Point">
  163. <_0 type="">
  164. <x>-1</x>
  165. <y>-1</y>
  166. </_0>
  167. <_1 type="">
  168. <x>1</x>
  169. <y>-1</y>
  170. </_1>
  171. <_2 type="">
  172. <x>1</x>
  173. <y>1</y>
  174. </_2>
  175. <_3 type="">
  176. <x>-1</x>
  177. <y>1</y>
  178. </_3>
  179. </vertices>
  180. </_0>
  181. </collisionShapes>
  182.  
  183. <size type="">
  184. <x>6</x>
  185. <y>14</y>
  186. </size>
  187.  
  188. </component>
  189.  
  190. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  191. <positionReference>@Spatial.position</positionReference>
  192. <rotationReference>@Spatial.rotation</rotationReference>
  193. <sizeReference>@Spatial.size</sizeReference>
  194. </component>
  195.  
  196. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  197. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  198. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  199. <defaultAnimation>Idle</defaultAnimation>
  200. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  201. <Idle type="">
  202. <frameRate>6</frameRate>
  203. <maxFrameDelay>1000</maxFrameDelay>
  204. <loop>true</loop>
  205. <spriteSheet componentReference="BulletSpriteSheet"/>
  206. </Idle>
  207. </animations>
  208. </component>
  209.  
  210. <component type="DestroyIfOffScreenComponent" name="DestroyIfOffScreen">
  211. <positionReference>@Spatial.position</positionReference>
  212. <screenWidth>480</screenWidth>
  213. <screenHeight>384</screenHeight>
  214. </component>
  215.  
  216. <component type="DamageOnContactConponent" name="DamageOnContact">
  217. <damage>1</damage>
  218. </component>
  219.  
  220. </template>
  221.  
  222. <template name="PlayerBullet" template="Bullet">
  223.  
  224. <component name="Spatial">
  225.  
  226. <collisionType childType="String">
  227. <_0>Renderable</_0>
  228. <_0>PlayerBullet</_0>
  229. </collisionType>
  230.  
  231. <collidesWithTypes childType="String">
  232. <_0>Enemy</_0>
  233. </collidesWithTypes>
  234.  
  235. </component>
  236.  
  237. </template>
  238.  
  239. <template name="Explosion">
  240.  
  241. <component type="com.pblabs.rendering2D.SimpleSpatialComponent" name="Spatial">
  242.  
  243. <spatialManager componentReference="SpatialDB"/>
  244.  
  245. <objectMask childType="String">
  246. <_0>Renderable</_0>
  247. </objectMask>
  248.  
  249. </component>
  250.  
  251. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  252. <positionReference>@Spatial.position</positionReference>
  253. </component>
  254.  
  255. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  256. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  257. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  258. <defaultAnimation>Idle</defaultAnimation>
  259. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  260. <Idle type="">
  261. <frameRate>6</frameRate>
  262. <maxFrameDelay>1000</maxFrameDelay>
  263. <loop>false</loop>
  264. <spriteSheet componentReference="ExplosionSpriteSheet"/>
  265. <startEvent>ExplosionStart</startEvent>
  266. <completeEvent>ExplosionComplete</completeEvent>
  267. </Idle>
  268. </animations>
  269. </component>
  270.  
  271. <component type="DestroyAfterCountdownComponent" name="DestroyAfterCountdown">
  272. <TimeToLive>0.5</TimeToLive>
  273. </component>
  274.  
  275. </template>
  276.  
  277. </things>