| 1 | <?xml version="1.0"?> |
| 2 | |
| 3 | <!-- |
| 4 | Define the "Knight" creature properties. See |
| 5 | https://castle-engine.io/creating_data_resources.php |
| 6 | for extensive documentation of available properties, in short: |
| 7 | |
| 8 | - name: used to refer to this creature from ObjectPascal code, |
| 9 | e.g. in Resources.FindName('Knight'). |
| 10 | Also to create placeholders to place initial creatures of this kind on level: |
| 11 | (place on the level, in Blender, object named 'CasResKnight'). |
| 12 | |
| 13 | - type: indicates ObjectPascal class used to handle this creature, |
| 14 | in this case TWalkAttackCreatureResource (and the |
| 15 | TWalkAttackCreatureResource, in turn, indicates that particular creature |
| 16 | on level will use TWalkAttackCreature class). |
| 17 | This is an intelligent walking-attacking creature. |
| 18 | |
| 19 | - model: animations 3D models. There are many ways to define them, |
| 20 | in this case we use glTF, exported from Blender. |
| 21 | |
| 22 | - radius and preferred_height: important for collision detection. |
| 23 | These are best visualized with "Render debug 3D" in fps_game. |
| 24 | See TCastleTransform.Sphere and TCastleTransform.Middle and |
| 25 | TCastleTransform.PreferredHeight documentation for |
| 26 | a precise meaning of these values. Engine *does* calculate good values |
| 27 | for them automatically, but they can be "tuned" manually to work even better |
| 28 | (that is because the engine does not know that these are humanoids, |
| 29 | and so their head is quite high in all animation states (aside from "die")). |
| 30 | --> |
| 31 | |
| 32 | <resource |
| 33 | name="Knight" |
| 34 | type="WalkAttack" |
| 35 | middle_height="0.75" |
| 36 | radius="0.5" |
| 37 | preferred_distance="3.5" |
| 38 | move_speed="1.75" |
| 39 | > |
| 40 | <model url="knight.gltf" pool="10" default_animation_transition="0.25"> |
| 41 | <idle animation_name="Idle" /> |
| 42 | <walk animation_name="Walk" /> |
| 43 | <attack animation_name="Attack" /> |
| 44 | <die animation_name="Die" /> |
| 45 | <hurt animation_name="Damaged" /> |
| 46 | </model> |
| 47 | |
| 48 | <!-- Note that time="xxx" attribute should be synchronized with "attack" |
| 49 | animation specified above to look good. This is the time during animation |
| 50 | when the actual "hit" (life loss, pain, knockback, and so on) occurs. |
| 51 | So this should be synchronized to occur when visually the sword falls |
| 52 | down on the player. --> |
| 53 | <attack max_distance="4.0" knockback_distance="4.0" time="0.5"> |
| 54 | <!-- Note that by default damage is 0, so player doesn't lose Life, |
| 55 | so we will not even show the "pain" FadeOut. --> |
| 56 | <damage const="1" random="1" /> |
| 57 | </attack> |
| 58 | </resource> |