<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sCoreXArachnus</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>-153</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>/// Initialization. 

image_speed = 0.16;
state = 0;
statetime = 0;
flashing = 0;
fxtimer = 0;
roomcenter_x = room_width/2;
roomcenter_y = room_height/2;
frequency_x = 0.1 + random_range(-0.05, 0.05);
amplitude_x = 0.5 + random_range(-0.1, 0.1);
timer_x = irandom(100);
frequency_y = 0.1 + random_range(-0.05, 0.05);
amplitude_y = 0.5 + random_range(-0.1, 0.1);
timer_y = irandom(100);
xx = 0;
yy = 0;
drawaura = 1;
roomoffsety = 0;

switch (room) {
    case rm_a2a04:
        sprite_index = sCoreXArachnus; 
        break;
    case rm_a3a01:  
        sprite_index = sCoreXTorizo;   
        roomoffsety = -100;
        break;
    case rm_a5b03a: 
        sprite_index = sCoreXSerris;   
        break;
    case rm_a8a11:  
        sprite_index = sCoreXGenesis;  
        break;
}

alarm[1] = 1;

glow = 0;
frequency_glow = 0.1;
amplitude_glow = 1;
timer_glow = 0;

screwattackpickupframe = irandom(4);
screwattackpickupangle = irandom(359);
screwattackpickupfx = 0;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="4">
      <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 Torizo Core-X camera.

with (oTorizoCoreXCam) instance_destroy();
</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>/// Create shell.

shell = instance_create(x, y, oCoreXShell);
shell.lastBossX = lastBossX;
shell.lastBossY = lastBossY;
shell.sprite_index = lastBossSprite;
shell.image_index = lastBossFrame;
shell.lastBossAngle = lastBossAngle;
shell.lastBossFacing = lastBossFacing;
shell.lastYscale = lastYscale;
shell.depth = lastBossDepth;
</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>/// Loop idle sound effect. 

if(state != 2 || state != 6) {
    sfx_play(sndCoreXIdle);
    alarm[0]=60;
}
</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>/// Move with shell.

if(instance_exists(oCoreXShell)) {
    x = oCoreXShell.x;
    y = oCoreXShell.y;
}
</string>
          </argument>
        </arguments>
      </action>
      <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>/// Shrink during pickup.

if(state == 6) {
    if(statetime == 0) {
        image_xscale = 1;
        image_xscale = 1;
        
        sa_image_index = round(random(2));
        sa_image_alpha = 1 + fxtimer * 0.1;
        sa_image_blend = make_color_rgb(50 + random(200), 255, 50 + random(200));
    }
    
    with (oCharacter) {
        speedmultiplier = 0;
        speedmultiresettimer = 10000;
        sfx_stop(sndCoreXIdle);
        alarm[0]=-1;
        Mute_Loops();
    }
    
    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) {
        if(room == rm_a2a04) {
            with(instance_create(oCharacter.x-8, oCharacter.y-8, scr_itemsopen(oControl.mod_grip))) {
                visible = false;
                active = 1;
            }
        }
        else {
            Unmute_Loops();
        }
        with (oCharacter) speedmultiresettimer = 0;
        global.enablecontrol = 1; 
        with(instance_find(oFXTrail, instance_number(oFXTrail) - 1)) {
            if(sprite_index == sScrewSpark) {             
                visible = true;
                sprite_index = sScrewAttack;
                image_index = other.screwattackpickupframe;
                image_alpha = 1;
                image_angle = other.screwattackpickupangle;
                image_blend = c_white;
                image_xscale = 1;
                image_yscale = 1;
            }
        }
        instance_destroy();
    }
}
</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>/// Core-X idle. 

if(!instance_exists(oCoreXShell)) {
    if(state == 0) {
        if(statetime == 0) flashing = 10000;
        
        move_towards_point(roomcenter_x, roomcenter_y+roomoffsety, 1);
        
        if(point_distance(x, y, roomcenter_x, roomcenter_y+roomoffsety) &lt;= 1) {
            speed = 0;
            state = 1;
            statetime = 0;
        }
        
        x += xx;
        y += yy;
    }
    if(state == 1) {
        if(statetime == 0) {
            alarm[0] = 30;
        }
        if(statetime == 30) {
            flashing = 0;
        }
        
        x += xx;
        y += yy;
    }
    
    statetime += 1; 
    
    timer_x++;
    if(timer_x &gt; 2 * pi/frequency_x) timer_x -= 2 * pi/frequency_x;
    
    timer_y++;
    if(timer_y &gt; 2 * pi/frequency_y) timer_y -= 2 * pi/frequency_y;     
    
    xx = sin(timer_x*frequency_x)*amplitude_x;
    yy = sin(timer_y*frequency_y)*amplitude_y;
}

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

timer_glow++;
if(timer_glow &gt; 2 * pi/frequency_glow) timer_glow -= 2 * pi/frequency_glow;     

glow = sin(timer_glow*frequency_glow)*amplitude_glow;
</string>
          </argument>
        </arguments>
      </action>
      <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>/// Pickup event.

if(state == 1 &amp;&amp; flashing == 0 &amp;&amp; state != 6) {
    if (distance_to_point(oCharacter.x, oCharacter.y-oCharacter.sprite_height/2) &lt; 0.1) {
        global.playerhealth += 500;
        if (global.playerhealth &gt; global.maxhealth) global.playerhealth = global.maxhealth;
        global.missiles += 75;
        if (global.missiles &gt; global.maxmissiles) global.missiles = global.maxmissiles;
        global.smissiles += 10;
        if (global.smissiles &gt; global.maxsmissiles) global.smissiles = global.maxsmissiles;
        global.pbombs += 2;
        if (global.pbombs &gt; global.maxpbombs) global.pbombs = global.maxpbombs;
        PlaySoundMono(sndAbsorbX);
        with(instance_create(oCharacter.x,oCharacter.y-oCharacter.sprite_height/2,oAbsorbX)) core = true;
        
        state = 6;
        statetime = 0;
        relativeX = x - oCharacter.x;
        relativeY = y - (oCharacter.y-oCharacter.sprite_height/2);
        screwattackpickupfx = oCharacter.fxtimer;
    }
}
</string>
          </argument>
        </arguments>
      </action>
      <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>/// Freeze Sarah during X pickup.
if(state == 6) {  
    global.enablecontrol = 0;
    with (oCharacter) {
        fxtimer = other.screwattackpickupfx;
        speedmultiplier = 0;
        speedmultiresettimer = 10000;
        kLeft = 0;
        kRight = 0;
        kUp = 0;
        kDown = 0;
        kJump = 0;
        kJumpPressed = 0;
        kRun = 0;
        kAim = 0;
        kFire = 0;
        kMissile = 0;
        charge = 0;
        Mute_Loops();
    }
    with(oFXTrail) {
        if(sprite_index == sScrewSpark) visible = false;
    }
}
</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 event.

if(state == 6) {
    with(oCharacter) {
        if (global.screwattack == 1 &amp;&amp; state == JUMPING &amp;&amp; vjump == 0 &amp;&amp; walljumping == 0 &amp;&amp; (inwater == 0 || global.currentsuit &gt;= 2)) {
            draw_set_blend_mode(bm_add);
            draw_sprite_ext(sScrewAttack, other.screwattackpickupframe, x, y - 15, 1, 1, other.screwattackpickupangle, c_white, 1);
            draw_set_blend_mode(bm_normal);
        }
    }
}

if(!instance_exists(oCoreXShell)) {
    if (flashing) {
        draw_sprite_ext(sprite_index, -1, x, 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, x, y, image_xscale, image_yscale, image_angle, -1, 1 - fxtimer * 0.1);
        draw_set_blend_mode(bm_normal);
    } else draw_self();
    
    if(!instance_exists(oCoreXShell) &amp;&amp; (state == 0 || state == 1)) {
        draw_sprite_ext(sCoreXAura, image_index, x, y, 1, 1, 0, c_white, drawaura);
        drawaura = !drawaura;
    }
}   
else if (shell.state != 0) draw_self();
</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>
