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