<?xml version="1.0" encoding="utf-8"?>
<ItemRenderer item="ITEM_ID_SERPENTAIL">
  <Data>
    <Sprite name="s_body" fileName="game/player_feet16.rttex" textureSize="32"/>
    <Sprite name="s_tail" fileName="game/player_feet16.rttex" textureSize="32"/>

    <Animations>
      <SpriteAnimation name="a_bodyIdle" sprite="s_body" animTime="100" playOnState="Action.Idle" isLoop="true">
        <Frame>31,19</Frame>
      </SpriteAnimation>
      <SpriteAnimation name="a_bodyMove" sprite="s_body" animTime="1000" playOnState="Action.Walk|Action.Jump|Action.Fall" isLoop="true">
        <Frame>21,19</Frame>
        <Frame>22,19</Frame>
        <Frame>23,19</Frame>
        <Frame>24,19</Frame>
        <Frame>25,19</Frame>
        <Frame>26,19</Frame>
        <Frame>27,19</Frame>
        <Frame>28,19</Frame>
        <Frame>29,19</Frame>
        <Frame>30,19</Frame>
      </SpriteAnimation>
      <SpriteAnimation name="a_tailIdle" sprite="s_tail" animTime="100" playOnState="Action.Idle" isLoop="true">
        <Frame>31,18</Frame>
      </SpriteAnimation>
      <SpriteAnimation name="a_tailMove" sprite="s_tail" animTime="1000" playOnState="Action.Walk|Action.Jump|Action.Fall" isLoop="true">
        <Frame>21,18</Frame>
        <Frame>22,18</Frame>
        <Frame>23,18</Frame>
        <Frame>24,18</Frame>
        <Frame>25,18</Frame>
        <Frame>26,18</Frame>
        <Frame>27,18</Frame>
        <Frame>28,18</Frame>
        <Frame>29,18</Frame>
        <Frame>30,18</Frame>
      </SpriteAnimation>
      <InterpolationVec4Animation name="ia_idle" variableName="tail_rotation" targetValue="0, 0, 0, 1" animTime="600" playOnState="Action.Idle"/>
      <InterpolationVec4Animation name="ia_walk" variableName="tail_rotation" targetValue="0, 0, 0, 1" animTime="400" playOnState="Action.Walk"/>
      <InterpolationVec4Animation name="ia_fall" variableName="tail_rotation" targetValue="30, 0, 0, 1" animTime="1000" playOnState="Action.Fall"/>
      <InterpolationVec4Animation name="ia_jump" variableName="tail_rotation" targetValue="-30, 0, 0, 1" animTime="1000" playOnState="Action.Jump"/>
    </Animations>

    <VariableMap>
      <Set name="tail_rotation">0, 0, 0, 1</Set>
      <Set name="tail_position">-7, 4, 0</Set>
    </VariableMap>

    <StateMachines>
      <StateMachine name="Action">
        <States>
          <State name="Idle" />
          <State name="Walk" />
          <State name="Jump" />
          <State name="Fall" />
        </States>
        <Transitions>
          <Transition to="Idle" from="Walk|Fall|Jump">
            <Condition type="and">
              <IsVariableFloat name="speed.x" operator="Less" abs="true">0.1</IsVariableFloat>
              <IsVariableBool name="onGround">true</IsVariableBool>
            </Condition>
          </Transition>
          <Transition to="Walk" from="Idle|Fall|Jump">
            <Condition type="and">
              <IsVariableFloat name="speed.x" operator="Greater" abs="true">0.1</IsVariableFloat>
              <IsVariableBool name="onGround">true</IsVariableBool>
            </Condition>
          </Transition>
          <Transition to="Jump" from="Idle|Walk|Fall">
            <Condition type="and">
              <IsVariableFloat name="speed.y" operator="Less">-0.1</IsVariableFloat>
              <IsVariableBool name="onGround">false</IsVariableBool>
            </Condition>
          </Transition>
          <Transition to="Fall" from="Walk|Jump|Idle">
            <Condition type="and">
              <IsVariableFloat name="speed.y" operator="Greater">0.1</IsVariableFloat>
              <IsVariableBool name="onGround">false</IsVariableBool>
            </Condition>
          </Transition>
        </Transitions>
      </StateMachine>
    </StateMachines>
    
    <RenderOptions>
      <Default>
        <Set name="PunchSoundOverride">SHOES</Set>
        <Set name="PlayDefaultPunchAudio">false</Set>
        <Set name="IsToRenderPants">false</Set>
        <Set name="ShoesHidesBodyLegs">true</Set>
        <Set name="ShoesShouldIgnoreRaptorLegsOffset">true</Set>
        <Set name="ClothingOffsetFromShoes">-8</Set>
        <Set name="UserNameOffset">8</Set>
      </Default>
    </RenderOptions>
  </Data>

  <RenderRules>
    <RenderShoes>
      <Group>
        <Translate>tail_position</Translate>
        <Rotate>tail_rotation</Rotate>
        <SpriteRender name="s_tail" alignmentLeft="LEFT_CENTER" alignmentRight="RIGHT_CENTER"/>
      </Group>
      <SpriteRender name="s_body" offset="0,-8"/>
    </RenderShoes>
  </RenderRules>
</ItemRenderer>