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. <_2>Player</_2>
  16. </collidesWithTypes>
  17.  
  18. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  19. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  20. <vertices childType="flash.geom.Point">
  21. <_0 type="">
  22. <x>-1</x>
  23. <y>-1</y>
  24. </_0>
  25. <_1 type="">
  26. <x>1</x>
  27. <y>-1</y>
  28. </_1>
  29. <_2 type="">
  30. <x>1</x>
  31. <y>1</y>
  32. </_2>
  33. <_3 type="">
  34. <x>-1</x>
  35. <y>1</y>
  36. </_3>
  37. </vertices>
  38. </_0>
  39. </collisionShapes>
  40.  
  41. <collisionType childType="String">
  42. <_0>Enemy</_0>
  43. <_1>Renderable</_1>
  44. </collisionType>
  45.  
  46. <size type="">
  47. <x>16</x>
  48. <y>16</y>
  49. </size>
  50.  
  51. </component>
  52.  
  53. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  54. <positionReference>@Spatial.position</positionReference>
  55. <rotationReference>@Spatial.rotation</rotationReference>
  56. <sizeReference>@Spatial.size</sizeReference>
  57. </component>
  58.  
  59. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  60. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  61. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  62. <defaultAnimation>Idle</defaultAnimation>
  63. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  64. <Idle type="">
  65. <frameRate>4</frameRate>
  66. <maxFrameDelay>250</maxFrameDelay>
  67. <loop>true</loop>
  68. <spriteSheet componentReference="Enemy1SpriteSheet"/>
  69. </Idle>
  70. </animations>
  71. </component>
  72.  
  73. <component type="com.pblabs.components.basic.HealthComponent" name="Health">
  74. <maxHealth>1</maxHealth>
  75. </component>
  76.  
  77. <component type="DeathHandlerComponent" name="DeathHandler">
  78. <PositionReference>@Spatial.position</PositionReference>
  79. <entityToCreateOnDeath>Explosion</entityToCreateOnDeath>
  80. </component>
  81.  
  82. <component type="EnemyControllerComponent" name="EnemyController">
  83. <PositionReference>@Spatial.position</PositionReference>
  84. <VelocityReference>@Spatial.linearVelocity</VelocityReference>
  85. </component>
  86.  
  87. <component type="DeathOnContactComponent" name="DeathOnContact">
  88. <deathCollisionTypes childType="String">
  89. <_0>Player</_0>
  90. </deathCollisionTypes>
  91. </component>
  92.  
  93. </template>
  94.  
  95. <template name="Player">
  96.  
  97. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  98.  
  99. <canMove>true</canMove>
  100. <canSleep>false</canSleep>
  101. <canRotate>false</canRotate>
  102. <manager componentReference="SpatialDB"/>
  103.  
  104. <collidesWithTypes childType="String">
  105. <_0>Enemy</_0>
  106. <_0>EnemyBullet</_0>
  107. </collidesWithTypes>
  108.  
  109. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  110. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  111. <vertices childType="flash.geom.Point">
  112. <_0 type="">
  113. <x>-1</x>
  114. <y>-1</y>
  115. </_0>
  116. <_1 type="">
  117. <x>1</x>
  118. <y>-1</y>
  119. </_1>
  120. <_2 type="">
  121. <x>1</x>
  122. <y>1</y>
  123. </_2>
  124. <_3 type="">
  125. <x>-1</x>
  126. <y>1</y>
  127. </_3>
  128. </vertices>
  129. </_0>
  130. </collisionShapes>
  131.  
  132. <collisionType childType="String">
  133. <_0>Player</_0>
  134. <_1>Renderable</_1>
  135. </collisionType>
  136.  
  137. <position>
  138. <x>240</x>
  139. <y>352</y>
  140. </position>
  141.  
  142. <size type="">
  143. <x>28</x>
  144. <y>16</y>
  145. </size>
  146.  
  147. </component>
  148.  
  149. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  150. <positionReference>@Spatial.position</positionReference>
  151. <rotationReference>@Spatial.rotation</rotationReference>
  152. <sizeReference>@Spatial.size</sizeReference>
  153. <spriteSheet componentReference="PlayerSpriteSheet"/>
  154. </component>
  155.  
  156. <component type="PlayerControllerComponent" name="PlayerController">
  157. <velocityReference>@Spatial.linearVelocity</velocityReference>
  158. <positionReference>@Spatial.position</positionReference>
  159. <screenWidth>480</screenWidth>
  160. <bulletEntityName>PlayerBullet</bulletEntityName>
  161. <timeBetweenShots>0.5</timeBetweenShots>
  162. </component>
  163.  
  164. <component type="DeathOnContactComponent" name="DeathOnContact">
  165. <deathCollisionTypes childType="String">
  166. <_0>Enemy</_0>
  167. </deathCollisionTypes>
  168. </component>
  169.  
  170. <component type="DeathHandlerComponent" name="DeathHandler">
  171. <PositionReference>@Spatial.position</PositionReference>
  172. <entityToCreateOnDeath>PlayerExplosion</entityToCreateOnDeath>
  173. </component>
  174.  
  175. <component type="com.pblabs.components.basic.HealthComponent" name="Health">
  176. <maxHealth>5</maxHealth>
  177. </component>
  178.  
  179. </template>
  180.  
  181. <template name="Bullet">
  182.  
  183. <component type="com.pblabs.box2D.Box2DSpatialComponent" name="Spatial">
  184.  
  185. <canMove>true</canMove>
  186. <canSleep>false</canSleep>
  187. <canRotate>false</canRotate>
  188. <manager componentReference="SpatialDB"/>
  189.  
  190. <collisionShapes childType="com.pblabs.box2D.CollisionShape">
  191. <_0 type="com.pblabs.box2D.PolygonCollisionShape">
  192. <vertices childType="flash.geom.Point">
  193. <_0 type="">
  194. <x>-1</x>
  195. <y>-1</y>
  196. </_0>
  197. <_1 type="">
  198. <x>1</x>
  199. <y>-1</y>
  200. </_1>
  201. <_2 type="">
  202. <x>1</x>
  203. <y>1</y>
  204. </_2>
  205. <_3 type="">
  206. <x>-1</x>
  207. <y>1</y>
  208. </_3>
  209. </vertices>
  210. </_0>
  211. </collisionShapes>
  212.  
  213. <size type="">
  214. <x>6</x>
  215. <y>14</y>
  216. </size>
  217.  
  218. </component>
  219.  
  220. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  221. <positionReference>@Spatial.position</positionReference>
  222. <rotationReference>@Spatial.rotation</rotationReference>
  223. <sizeReference>@Spatial.size</sizeReference>
  224. </component>
  225.  
  226. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  227. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  228. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  229. <defaultAnimation>Idle</defaultAnimation>
  230. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  231. <Idle type="">
  232. <frameRate>6</frameRate>
  233. <maxFrameDelay>1000</maxFrameDelay>
  234. <loop>true</loop>
  235. <spriteSheet componentReference="BulletSpriteSheet"/>
  236. </Idle>
  237. </animations>
  238. </component>
  239.  
  240. <component type="DestroyIfOffScreenComponent" name="DestroyIfOffScreen">
  241. <positionReference>@Spatial.position</positionReference>
  242. <screenWidth>480</screenWidth>
  243. <screenHeight>384</screenHeight>
  244. </component>
  245.  
  246. <component type="DamageOnContactComponent" name="DamageOnContact">
  247. <damage>1</damage>
  248. </component>
  249.  
  250. </template>
  251.  
  252. <template name="PlayerBullet" template="Bullet">
  253.  
  254. <component name="Spatial">
  255.  
  256. <collisionType childType="String">
  257. <_0>Renderable</_0>
  258. <_0>PlayerBullet</_0>
  259. </collisionType>
  260.  
  261. <collidesWithTypes childType="String">
  262. <_0>Enemy</_0>
  263. </collidesWithTypes>
  264.  
  265. </component>
  266.  
  267. </template>
  268.  
  269. <template name="EnemyBullet" template="Bullet">
  270.  
  271. <component name="Spatial">
  272.  
  273. <collisionType childType="String">
  274. <_0>Renderable</_0>
  275. <_0>EnemyBullet</_0>
  276. </collisionType>
  277.  
  278. <collidesWithTypes childType="String">
  279. <_0>Player</_0>
  280. </collidesWithTypes>
  281.  
  282. </component>
  283.  
  284. </template>
  285.  
  286. <template name="Explosion">
  287.  
  288. <component type="com.pblabs.rendering2D.SimpleSpatialComponent" name="Spatial">
  289.  
  290. <spatialManager componentReference="SpatialDB"/>
  291.  
  292. <objectMask childType="String">
  293. <_0>Renderable</_0>
  294. </objectMask>
  295.  
  296. </component>
  297.  
  298. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  299. <positionReference>@Spatial.position</positionReference>
  300. </component>
  301.  
  302. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  303. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  304. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  305. <defaultAnimation>Idle</defaultAnimation>
  306. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  307. <Idle type="">
  308. <frameRate>6</frameRate>
  309. <maxFrameDelay>1000</maxFrameDelay>
  310. <loop>false</loop>
  311. <spriteSheet componentReference="ExplosionSpriteSheet"/>
  312. <startEvent>ExplosionStart</startEvent>
  313. <completeEvent>ExplosionComplete</completeEvent>
  314. </Idle>
  315. </animations>
  316. </component>
  317.  
  318. <component type="DestroyAfterCountdownComponent" name="DestroyAfterCountdown">
  319. <TimeToLive>0.5</TimeToLive>
  320. </component>
  321.  
  322. </template>
  323.  
  324. <template name="PlayerExplosion">
  325.  
  326. <component type="com.pblabs.rendering2D.SimpleSpatialComponent" name="Spatial">
  327.  
  328. <spatialManager componentReference="SpatialDB"/>
  329.  
  330. <objectMask childType="String">
  331. <_0>Renderable</_0>
  332. </objectMask>
  333.  
  334. </component>
  335.  
  336. <component type="com.pblabs.rendering2D.SpriteRenderComponent" name="Render">
  337. <positionReference>@Spatial.position</positionReference>
  338. </component>
  339.  
  340. <component type="com.pblabs.rendering2D.AnimationController" name="Animation">
  341. <spriteSheetReference>@Render.spriteSheet</spriteSheetReference>
  342. <currentFrameReference>@Render.spriteIndex</currentFrameReference>
  343. <defaultAnimation>Idle</defaultAnimation>
  344. <animations childType="com.pblabs.rendering2D.AnimationControllerInfo">
  345. <Idle type="">
  346. <frameRate>6</frameRate>
  347. <maxFrameDelay>1000</maxFrameDelay>
  348. <loop>false</loop>
  349. <spriteSheet componentReference="PlayerExplosionSpriteSheet"/>
  350. <startEvent>ExplosionStart</startEvent>
  351. <completeEvent>ExplosionComplete</completeEvent>
  352. </Idle>
  353. </animations>
  354. </component>
  355.  
  356. <component type="DestroyAfterCountdownComponent" name="DestroyAfterCountdown">
  357. <TimeToLive>0.5</TimeToLive>
  358. </component>
  359.  
  360. </template>
  361.  
  362. </things>