<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>&lt;undefined&gt;</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>-200</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>///Primary Settings
state = 0;
statetime = 0;
collectable = 0;
reform = random(1);
move = 0;

image_speed = 0.2;
xvariant = 0;
xtype = sHXPickup;
flashing = 0;
fxtimer = 0;

sizeX = 1;
sizeY =1;

relativeX = 0;
relativeY = 0;

// origin point velocity
originVelX = 0;
originVelY = 0;
// parasite velocity
velX = 0;
velY = 0;
 
//counter for it to stand still for a bit before moving
counter = 30;
 
//orbit point
orbitX = xstart;
orbitY = ystart;
orbitCounter = 0; //orbit point randomize counter
xExit = choose(-5,5,-7,7,-9,9);
yExit = choose(-5,5,-7,7,-9,9);

frozenAngle = 0;
drawAngle = 0;

drawHalzynShields = false;

inview = true;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="3" enumb="2">
      <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(state == 6) { //Shrink during pickup
    if(floor(statetime) == 0) {
        image_xscale = 1;
        image_xscale = 1;
        
        if(xvariant == 1) {
            image_xscale = 0.8;
            image_xscale = 0.8;
        }
    }
    
    x = oCharacter.x + relativeX;
    y = (oCharacter.y-oCharacter.sprite_height/2) + relativeY;
    
    relativeX = lerp(relativeX, 0, 0.1);
    relativeY = lerp(relativeY, 0, 0.1);
    
    if(image_xscale &gt; 0) {
        image_xscale -= 0.0225;
        image_yscale -= 0.0225;
    }
    
    if(image_xscale &lt;= 0) instance_destroy();
}

//inview widescreen fix
if ((x &lt; (view_xview[0] - 16 - (oControl.widescreen_space/2))) || (x &gt; (view_xview[0] + view_wview[0] + 16 + (oControl.widescreen_space/2))) || (y &lt; view_yview[0] - 16) || (y &gt; view_yview[0] + view_hview[0] + 16)) {
    inview = false;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="3" 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>inview = true;
</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>///X Movement
//Thanks for the movement code, Scoot!

if (fxtimer &lt; 10) {
    fxtimer += 1;
} else fxtimer = 0;
if (flashing &gt; 0) flashing -= 1;

if(state == 0) { //Initial settings that we can't run in the create event because reasons
    image_alpha = 1;
    depth = lastDepth;
    sprite_index = lastSprite;
    image_index = lastFrame;
    image_angle = lastAngle;
    image_xscale = lastFacing;
    image_xscale = lastYscale;
    image_speed = 0;
    state = 1;
    statetime = 0;
    
    xoffset =  sprite_get_xoffset(lastSprite) - (mean(sprite_get_bbox_left(lastSprite), sprite_get_bbox_right(lastSprite)))
    lastXPos -= xoffset;
    yoffset = sprite_get_yoffset(lastSprite) - (mean(sprite_get_bbox_top(lastSprite), sprite_get_bbox_bottom(lastSprite)))
    lastYPos -= yoffset;
    
    if(frozenAngle != 0) 
        drawAngle = frozenAngle;
    else 
        drawAngle = lastAngle;
        
    if(sprite_index == sRamulken) sprite_index = sRamulkenNoShield;
    
    if (lastEnemy == oCavedropper ||
        lastEnemy == oBlobAir ||
        lastEnemy == oBlobWater ||
        lastEnemy == oGawron ||
        lastEnemy == oYumee||
        lastEnemy == oSkreek ||
        lastEnemy == oErisSegment ||
        lastEnemy == oErisBody2 ||
        lastEnemy == oMeboid || 
        lastEnemy == oMeboid2) reform = -1;
}
if(state == 1) { //Spawn transition state
    if(statetime == 0) PlaySoundMono(sndXMorph1);
    if(statetime &lt;= 40) {
        sizeX = sizeX + 0.12;
        sizeY = sizeY + 0.08;
    }
    if(statetime &gt;= 40) {
        sizeX = sizeX - 0.12;
        sizeY = sizeY - 0.08;
        if(statetime == 40) {
            collectable = 1;
            sprite_index = xtype;
            depth = -200;
            image_index = 0;
            image_speed = 0.2;
            image_angle = 0;
            image_xscale = 1;
            image_yscale = 1;
            if(xvariant == 1) {
                image_xscale = 0.8;
                image_yscale = 0.8;
            }
        }
        if(statetime &gt;= 81) {
            state = 2;
            statetime = 0;
        }
    }
}
if(state == 2) //Normal Movement
{
    move = 1;
    if(statetime == 0) collectable = 1;
    if(counter &gt; 0) { //Counter before movement
        move = 0;
        counter--;
    }
    else { //Randomize orbit point every 30 frames
        if(orbitCounter &gt; 0) {
            orbitCounter--;
        }
        else {//Target either the Orbit Point or Sarah
            var angle = random(360);
            if(oCharacter.chargebeam == 0) { //Orbit Point  
                orbitX = xstart + lengthdir_x(32,angle);
                orbitY = ystart + lengthdir_y(32,angle);
            }
            else if(oCharacter.chargebeam &gt;= 1) { //Sarah
                orbitX = oCharacter.x;
                orbitY = oCharacter.y - oCharacter.sprite_height/2;
            }
            orbitCounter = irandom_range(15,25); //Time before targeting again
        }
 
        //Maximum speed
        velX = clamp(velX,-4,4);
        velY = clamp(velY,-4,4);
    
    }
    xstart += originVelX;
    ystart += originVelY;
    if(reform &gt;= 0.5 &amp;&amp; statetime &gt;= 155) {
        state = 4;
        statetime = 0;
        collectable = 0;
    }
    else if(statetime &gt;= 620) {
        state = 3;
        statetime = 0;
    }
}
if(state == 3) { //Fly away
    move = 1;
    orbitX += xExit;
    orbitY += yExit;
    //Maximum speed
    velX = clamp(velX,-4,4);
    velY = clamp(velY,-4,4);
}
if(state == 4) { //Prepare for respawn
    flashing = 2;
    if(statetime == 0) {
        if(lastEnemy != oSkorp &amp;&amp; lastEnemy != oGlowFly) lastAngle = 0;
        if(lastEnemy = oHalzyn) drawHalzynShields = true;
        drawAngle = lastAngle;
    }
    if(statetime &lt; 120) {
        move = 1;
        orbitX = lastXPos;
        orbitY = lastYPos;
        //Maximum speed
        velX = clamp(velX,-3,3);
        velY = clamp(velY,-3,3);
    }
    if(statetime &gt; 120 &amp;&amp; point_distance(x,y,lastXPos,lastYPos) &gt; 2) {
        move = 0;
        move_towards_point(lastXPos,lastYPos,2);
    }
    else if(point_distance(x,y,lastXPos,lastYPos) &lt;= 2) {
        move = 0;
        x = lastXPos;
        y = lastYPos;
        speed = 0;
        state = 5;
        statetime = 0;
    }
}
if(state == 5) { //Respawn transition

    if(statetime == 0) PlaySoundMono(sndXMorph1);
    if(statetime &lt;= 40) {
        sizeX = sizeX + 0.12;
        sizeY = sizeY + 0.08;
    }
    if(statetime &gt;= 40) {
        sizeX = sizeX - 0.12;
        sizeY = sizeY - 0.08;
        if(statetime == 40) {
            image_speed = 0;
            sprite_index = lastSprite;
            image_xscale = lastFacing;
            image_index = 0
            depth = lastDepth;
            lastEnemyX = x + xoffset;
            lastEnemyY = y + yoffset;
        }
        if(statetime &gt;= 81) {
            enemy = instance_create(lastXPos + xoffset, lastYPos + yoffset, lastEnemy);
            enemy.facing      = lastFacing;
            enemy.myhealth    = enemy.myhealth/2;
            enemy.timer       = lastEnemyTimer;
            enemy.rotspeed    = lastEnemyRotspeed;
            enemy.myspeed     = lastEnemyMyspeed;
            enemy.offset      = lastEnemyOffset;
            enemy.moveratio   = lastEnemyMoveratio;
            enemy.movesteps   = lastEnemyMovesteps;
            enemy.image_angle = lastAngle;
            if (lastEnemy == oHalzyn) {
                enemy.glow = lastEnemyGlow;
            }
            instance_destroy();
        }
    }
}

if(move == 1) { //Orbital movement
    var ang = point_direction(x,y,orbitX,orbitY);
    velX += lengthdir_x(0.2,ang);
    velY += lengthdir_y(0.2,ang);
    x += velX;
    y += velY;
}

statetime += 1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="40">
      <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>//inview = false;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" 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>///Destroy if outside room &amp;&amp; state == 3
if(state == 3) {
    if ((x &lt; (view_xview[0] - (oControl.widescreen_space/2))) || (x &gt; (view_xview[0] + view_wview[0] + (oControl.widescreen_space/2))) || (y &lt; 0) || (y &gt; room_height)) {
        instance_destroy();
    }
}
</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>other</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>if(state == 1 || state == 5) {
    if(inview) {
        if(sprite_index == xtype) draw_sprite_pixelated(sprite_index, image_index, x, y, image_xscale, 1, image_angle, c_white, 1, sizeX, sizeY, 16);
        else {
            draw_sprite_pixelated(sprite_index, image_index, lastEnemyX, lastEnemyY, lastFacing, 1, drawAngle, c_white, 1, sizeX, sizeY, 128);
            
            if(sprite_index == sSkorpBody) {
                draw_sprite_pixelated(sSkorpDiscLunge, 0, lastEnemyX + lengthdir_x(11, lastAngle - 24), lastEnemyY + lengthdir_y(11, lastAngle - 24), -1, 1, 0, c_white, 1, sizeX, sizeY, 32);   
                draw_sprite_pixelated(sSkorpDiscLunge, 0, lastEnemyX + lengthdir_x(11, lastAngle + 24), lastEnemyY + lengthdir_y(11, lastAngle + 24), 1, 1, 0, c_white, 1, sizeX, sizeY, 32);
                
            }
            
            if(drawHalzynShields) {
                var shield;
                if (lastEnemyGlow == 1) {
                    shield = sHalzynShieldA4;
                } else if (lastEnemyGlow == 2) {
                    shield = sHalzynShieldA4_2;
                } else {
                    shield = sHalzynShield;
                }
                draw_sprite_pixelated(shield, 0, lastEnemyX + 8, lastEnemyY - 3, 1, 1, 0, c_white, 1, sizeX, sizeY, 32);
                draw_sprite_pixelated(shield, 0, lastEnemyX - 8, lastEnemyY - 3, -1, 1, 0, c_white, 1, sizeX, sizeY, 32);
            }
        }
    }
}
else if(!flashing) {
    //draw_self();
    draw_sprite_ext(sprite_index, -1, round(x), round(y), image_xscale, image_yscale, image_angle, image_blend, image_alpha);
}
else if(flashing) {
    draw_sprite_ext(sprite_index, -1, round(x), round(y), image_xscale, image_yscale, image_angle, make_color_rgb(80, 80, 80), 1);
    draw_set_blend_mode(bm_add);
    repeat (3) draw_sprite_ext(sprite_index, -1, round(x), round(y), image_xscale, image_yscale, image_angle, -1, 1 - fxtimer * 0.1);
    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>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
