Advertisement
PirateHearts

Sample entity definition (Gunmetal Arcadia)

Jan 2nd, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 9.48 KB | None | 0 0
  1.  
  2. <!-- Sprite sheet for entity template Slime -->
  3. <render />
  4. <sprite sheet="XK_Slime.bmp" name="Texture_XK_Slime" />
  5.  
  6. <!-- Skipping automatic exports for abstract entity template Xanadu Entity -->
  7.  
  8. <!-- This is a hint to the entity factory to specify a class to construct in game code. -->
  9. <!-- Xanadu entities are most physical things that have presence in the game world, are affected by gravity, and so on. -->
  10.  
  11. <class name="xanaduentity" />
  12.  
  13.  
  14. <!-- Skipping automatic exports for abstract entity template Sprite Base -->
  15.  
  16. <render />
  17. <space>
  18.     <position>
  19.         <!-- Default to behind the player. -->
  20.         <vector z="5.0" />
  21.     </position>
  22. </space>
  23. <camera />
  24. <anim />
  25. <sprite />
  26.  
  27.  
  28.  
  29. <!-- Skipping automatic exports for abstract entity template Assigned GUID -->
  30.  
  31. <!-- This thing is assigned a GUID at runtime so that it can be serialized. -->
  32. <!-- A typical use case would be an item drop that should persist if we leave and return. -->
  33.  
  34. <guid guid="assign" />
  35.  
  36.  
  37. <!-- Skipping automatic exports for abstract entity template Data Haver -->
  38.  
  39. <!-- This is just a thing that has a data component. -->
  40. <!-- This can track arbitrary data external to other components. -->
  41.  
  42. <data />
  43.  
  44.  
  45. <!-- Skipping automatic exports for abstract entity template Screen Bounded -->
  46.  
  47. <!-- This is a thing that will be destroyed if it goes offscreen. -->
  48.  
  49. <bounds />
  50.  
  51.  
  52. <!-- Skipping automatic exports for abstract entity template Facing Left -->
  53.  
  54. <facing facing="left" />
  55.  
  56. <!-- Skipping automatic exports for abstract entity template Deletable -->
  57.  
  58. <delete />
  59.  
  60. <!-- Skipping automatic exports for abstract entity template Loot Dropper -->
  61.  
  62. <loot>
  63.     <!-- We will roll on EACH opportunity. -->
  64.     <!-- Things that may only drop at most one item should only have one opportunity. -->
  65.     <opportunity>
  66.         <roll weight="20" drop="" />
  67.         <roll weight="10" drop="Ammo" />
  68.         <roll weight="4" drop="Bombs" />
  69.         <roll weight="10" drop="Coin" />
  70.         <roll weight="8" drop="Gem" />
  71.         <roll weight="6" drop="Heart" />
  72.         <roll weight="4" drop="Key" />
  73.     </opportunity>
  74.  
  75.     <!-- These XP pellets feel bad man. -->
  76.     <!-- opportunity><roll weight="1" drop="XP" /></opportunity -->
  77. </loot>
  78.  
  79. <!-- Skipping automatic exports for abstract entity template Enemy Allegiance -->
  80.  
  81. <allegiance name="enemy" />
  82.  
  83. <!-- Animation for entity template Slime -->
  84. <anim>
  85.     <sequence name="Idle" priority="0" duration="0.5" loop="True" startplaying="True" scrub="0" jump="False" trumpstop="False" primitive="">
  86.         <frame durweight="1" x="0" y="4" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  87.         </frame>
  88.         <frame durweight="1" x="16" y="5" w="16" h="11" spoffx="0" spoffy="0" spsclx="16" spscly="11">
  89.         </frame>
  90.         <frame durweight="1" x="0" y="4" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  91.         </frame>
  92.         <frame durweight="1" x="33" y="3" w="14" h="13" spoffx="0" spoffy="-1" spsclx="14" spscly="13">
  93.         </frame>
  94.     </sequence>
  95.     <sequence name="Hurt" priority="8" duration="1" loop="True" startplaying="False" scrub="0" jump="False" trumpstop="False" primitive="">
  96.         <frame durweight="1" x="0" y="20" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  97.         </frame>
  98.     </sequence>
  99.     <sequence name="Shake" priority="2" duration="0.125" loop="True" startplaying="False" scrub="0" jump="False" trumpstop="False" primitive="">
  100.         <frame durweight="1" x="0" y="4" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  101.         </frame>
  102.         <frame durweight="1" x="33" y="3" w="14" h="13" spoffx="0" spoffy="0" spsclx="14" spscly="13">
  103.         </frame>
  104.     </sequence>
  105.     <sequence name="Jump" priority="4" duration="1" loop="False" startplaying="False" scrub="0" jump="True" trumpstop="False" primitive="">
  106.         <frame durweight="1" x="33" y="3" w="14" h="13" spoffx="0" spoffy="-1" spsclx="14" spscly="13">
  107.         </frame>
  108.         <frame durweight="1" x="0" y="4" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  109.         </frame>
  110.         <frame durweight="1" x="16" y="5" w="16" h="11" spoffx="0" spoffy="0" spsclx="16" spscly="11">
  111.         </frame>
  112.         <frame durweight="1" x="0" y="4" w="16" h="12" spoffx="0" spoffy="0" spsclx="16" spscly="12">
  113.         </frame>
  114.         <frame durweight="1" x="33" y="3" w="14" h="13" spoffx="0" spoffy="-1" spsclx="14" spscly="13">
  115.         </frame>
  116.     </sequence>
  117.     <sequence name="Drip" priority="3" duration="1" loop="True" startplaying="False" scrub="0" jump="False" trumpstop="False" primitive="">
  118.         <frame durweight="1" x="16" y="16" w="16" h="4" spoffx="0" spoffy="-3" spsclx="16" spscly="4">
  119.         </frame>
  120.         <frame durweight="1" x="16" y="21" w="16" h="5" spoffx="0" spoffy="-3" spsclx="16" spscly="5">
  121.         </frame>
  122.         <frame durweight="1" x="16" y="26" w="16" h="6" spoffx="0" spoffy="-2" spsclx="16" spscly="6">
  123.         </frame>
  124.         <frame durweight="1" x="32" y="16" w="16" h="8" spoffx="0" spoffy="-1" spsclx="16" spscly="8">
  125.         </frame>
  126.         <frame durweight="1" x="32" y="24" w="16" h="3" spoffx="0" spoffy="-4" spsclx="16" spscly="3">
  127.         </frame>
  128.         <frame durweight="1" x="16" y="16" w="16" h="4" spoffx="0" spoffy="-3" spsclx="16" spscly="4">
  129.         </frame>
  130.     </sequence>
  131.     <sequence name="Fall" priority="5" duration="0.3" loop="False" startplaying="False" scrub="0" jump="False" trumpstop="True" primitive="">
  132.         <onend>
  133.             <action text="anim self play FallingLoop" />
  134.         </onend>
  135.         <frame durweight="1" x="48" y="0" w="8" h="9" spoffx="0" spoffy="0" spsclx="8" spscly="9">
  136.         </frame>
  137.         <frame durweight="1" x="48" y="9" w="10" h="13" spoffx="0" spoffy="-1" spsclx="10" spscly="13">
  138.         </frame>
  139.     </sequence>
  140.     <sequence name="Land" priority="7" duration="0.125" loop="False" startplaying="False" scrub="0" jump="False" trumpstop="False" primitive="">
  141.         <frame durweight="1" x="48" y="22" w="16" h="10" spoffx="0" spoffy="1" spsclx="16" spscly="10">
  142.         </frame>
  143.     </sequence>
  144.     <sequence name="FallingLoop" priority="6" duration="0.3" loop="True" startplaying="False" scrub="0" jump="False" trumpstop="True" primitive="">
  145.         <frame durweight="1" x="48" y="9" w="10" h="13" spoffx="0" spoffy="-1" spsclx="10" spscly="13">
  146.         </frame>
  147.     </sequence>
  148. </anim>
  149.  
  150. <!-- Collision for entity template Slime -->
  151. <collision blocker="False" shallowledge="False" sweep="fdfaffcf">
  152.     <primitive name="Default" type="box" response="slide" filter="02000001" default="True">
  153.         <extents>
  154.             <vector x="6" y="5" />
  155.         </extents>
  156.         <offset>
  157.             <vector x="0" y="0" />
  158.         </offset>
  159.     </primitive>
  160. </collision>
  161. <sprite subpalette="Slime Subpalette" />
  162. <physics>
  163.     <constants
  164.         footspeed="80.0"
  165.         jumptime="0.240"
  166.         effectsthreshold="0"
  167.     >
  168.         <jump height="20" />
  169.     </constants>
  170.  
  171.     <event name="onland">
  172.         <action text="anim self play land" />
  173.         <action text="ai self stop" />
  174.         <action text="ai self choosebehavior" />
  175.     </event>
  176.  
  177.     <!-- In case we spawn on the ground. -->
  178.     <event name="onspawngrounded">
  179.         <!-- lol emepty queries cause crashes btw -->
  180.         <!-- query text="" / -->
  181.         <action text="ai self stop" />
  182.         <action text="ai self choosebehavior" />
  183.     </event>
  184.  
  185. </physics>
  186.  
  187. <title text="Slime" />
  188. <health invtime="0.0" stuntime="0.25" freeze="true" max="5" default="5" hurtanim="hurt">
  189.     <event name="ondamaged">
  190.         <action text="playsound attack 85 unique" />
  191.     </event>
  192.     <event name="ondepleted">
  193.         <action text="playfx sparkle" />
  194.     </event>
  195.     <event name="ondied">
  196.         <action text="droploot" />
  197.     </event>
  198. </health>
  199.  
  200. <ai>
  201.     <!-- General pattern: If we're a thing that wants to be aware of the player, -->
  202.     <!-- and we ARE aware of player, turn to face them. -->
  203.     <!-- Then choose one of three options: -->
  204.     <!-- 1. Sit in place and do nothing. -->
  205.     <!-- 2. Walk forward some distance. -->
  206.     <!-- 3. Play shake animation and then jump forward. -->
  207.     <!-- We become player-aware when we take damage from the player -->
  208.     <!-- or when they enter our line of sight. -->
  209.     <!-- We lose awareness when they leave our line of sight and some time passes. -->
  210.  
  211.     <!-- action text="face player" / -->
  212.  
  213.     <behaviorset>
  214.         <behavior weight="0.5">
  215.             <action text="ai self stop" />
  216.             <wait time="1.0" />
  217.         </behavior >
  218.         <behavior weight="1.0">
  219.             <action text="ai self stop" />
  220.             <!-- Wait a short time before jumping in case we landed. -->
  221.             <!-- Jumping immediately looks weird. -->
  222.             <wait time="0.15" />
  223.             <action text="anim self play shake" />
  224.             <wait time="0.55" />
  225.             <action text="anim self stop shake" />
  226.             <action text="ai self jump forward 1.0" />
  227.             <!-- On landing, we choose a new action. -->
  228.             <!-- Negative wait time means wait forever. -->
  229.             <!-- We'll reset this when choosing a new behavior. -->
  230.             <!-- But just in case we don't get our land event, let's set SOME time here. -->
  231.             <wait time="4.0" />
  232.         </behavior >
  233.         <behavior weight="3.0">
  234.             <action text="ai self walk forward 0.25" />
  235.             <wait time="0.5" />
  236.         </behavior >
  237.         <behavior weight="0.75">
  238.             <action text="ai self stop" />
  239.             <wait time="0.25" />
  240.             <action text="ai self turn" />
  241.             <wait time="0.5" />
  242.         </behavior >
  243.     </behaviorset>
  244.  
  245.     <event name="onhitwall">
  246.         <query>
  247.             <condition>
  248.                 <expression text="grounded" />
  249.             </condition>
  250.             <true>
  251.                 <!-- This is what slimes and stuff will want. -->
  252.                 <action text="ai self turn" />
  253.             </true>
  254.             <false>
  255.             </false>
  256.         </query>
  257.     </event>
  258. </ai>
  259.  
  260. <script>
  261.     <onfullyloaded WithSerial="false">
  262.         <!-- In case we spawn in the air. -->
  263.         <action text="ai self stop" />
  264.         <action text="ai self wait 60.0f" />
  265.     </onfullyloaded>
  266. </script>
  267.  
  268.  
  269.  
  270.  
  271. <!-- GUID for entity instance 74ecdb54 -->
  272. <guid guid="74ecdb54" />
  273.  
  274. <!-- Position for entity instance 74ecdb54 -->
  275. <space>
  276.     <position>
  277.         <vector x="216" y="56" />
  278.     </position>
  279. </space>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement