<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sHatchling</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>-155</depth>
  <persistent>0</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>&lt;undefined&gt;</maskName>
  <events>
    <event eventtype="0" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>image_speed = 0.25;
targetx = x;
targety = y;
accel = 0.4;
maxspeed = 3;
followplayer = 1;
roaring = 0;
alarm[0] = 120 + random(100);
mealtimer = 0;
flash = 0;
chaseX = 0;
alarm1set = 0;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="1">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>chaseX = 1;

followplayer = 0;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>sfx_play(choose(sndHatchling,sndHatchling2,sndHatchling3,sndHatchling4));
alarm[0] = 300 + irandom(320);
roaring = 60;

/*sfx_play(sndHatchling);

</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="3" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if (global.event[304] == 1 &amp;&amp; distance_to_object(oA7Crystal1) &lt; 120) {
    tgtobj = instance_nearest(x, y, oA7Crystal1);
    if (tgtobj != -4) {
        targetx = tgtobj.x + 8;
        targety = tgtobj.y + 8;
        accel = 0.4;
        maxspeed = 3.2;
        if (mealtimer &gt; 600) accel *= 2;
    }
    followplayer = 0;
} 
else if (distance_to_object(oXPickup) &lt; 150 ) {
    if (chaseX == 1)
    {
        tgtobj = instance_nearest(x, y, oXPickup);
        if (tgtobj != -4) {
            targetx = tgtobj.x;
            targety = tgtobj.y - 11;
            accel = 0.4;
            maxspeed = 3.2;
            if (mealtimer &gt; 600) accel *= 2;
        }
        followplayer = 0;
    }
    else if (alarm1set == 0)
    {
        alarm1set = 1;
        alarm[1] = 45;
    }
    
    
}
/*
else if (distance_to_object(oEnemy) &lt; 120 ) {
    if (chaseX == 1)
    {
        tgtobj = instance_nearest(x, y, oEnemy);
        if (tgtobj != -4) {
            targetx = tgtobj.x;
            targety = tgtobj.y - 11;
            accel = 0.4;
            maxspeed = 3.2;
            if (mealtimer &gt; 600) accel *= 2;
        }
        followplayer = 0;
    }
    else if (alarm1set == 0)
    {
        alarm1set = 1;
        alarm[1] = 90;
    }
    
    
}
*/

else 
{
    followplayer = 1;
    chaseX = 0;
    alarm1set = 0;
}

if (followplayer) {
    targetx = oCharacter.x;
    targety = oCharacter.y - 30;
    if (distance_to_point(oCharacter.x, oCharacter.y - 16) &gt; 128) {
        accel = 0.8;
        maxspeed = 8;
    }
    if (distance_to_point(oCharacter.x, oCharacter.y - 16) &gt; 64) {
        accel = 0.6;
        maxspeed = 6;
    } else if (distance_to_point(oCharacter.x, oCharacter.y - 16) &gt; 32) {
        accel = 0.4;
        maxspeed = 4;
    } else {
        accel = 0.3;
        maxspeed = 2.5;
    }
}
if (roaring &gt; 0) {
    roaring -= 1;
    image_speed = 1;
} else if (image_speed &gt; 0.25) image_speed -= 0.1;
if (flash &gt; 0) flash -= 0.1;
gravity_direction = point_direction(x, y, targetx, targety);
gravity = accel;
if (speed &gt; 4) speed = maxspeed;
mealtimer += 1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="8" enumb="0">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>draw_self();
draw_set_blend_mode(bm_add);
draw_sprite_ext(sprite_index, -1, x, y, 1, 1, 0, -1, flash);
draw_set_blend_mode(bm_normal);
</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>-1</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
