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

acceleration = 0.08;
maxspeed = 3.25;
drag = 0.025;
forcemissile = 4;
forcesupermissile = 5;
// health PER STAGE
myhealth[0] = 1; // blue
myhealth[1] = 1; // yellow
myhealth[2] = 1; // red
damage = 40;
missiledamage = 1;
superdamage = 2;
gravity = 0;
gravity_direction = 270;
state = 0;
statetime = 0;
canbehit = 1;
flashing = 0;
fxtimer = 0;
invulnerability = 180;
sparkcount = 2;
image_index = 0;
image_speed = 0;
sprite_index = sCoreXShell;
canSpawnX = true;
canbeX = 1;

if(room == rm_a2a04) { // Arachnus
    damage = global.mod_coreArachnusDamage;
    myhealth[0] = global.mod_coreArachnusHealthBlue;
    myhealth[1] = global.mod_coreArachnusHealthYellow;
    myhealth[2] = global.mod_coreArachnusHealthRed;
}

if(room == rm_a3a01) { // Torizo
    damage = global.mod_coreTorizoDamage;
    myhealth[0] = global.mod_coreTorizoHealthBlue;
    myhealth[1] = global.mod_coreTorizoHealthYellow;
    myhealth[2] = global.mod_coreTorizoHealthRed;
}

if(room == rm_a8a11) { // Genesis
    damage = global.mod_coreGenesisDamage;
    myhealth[0] = global.mod_coreGenesisHealthBlue;
    myhealth[1] = global.mod_coreGenesisHealthYellow;
    myhealth[2] = global.mod_coreGenesisHealthRed;
}

if(room == rm_a5b03a) { //Eris
    damage = global.mod_coreErisDamage;
    myhealth[0] = global.mod_coreErisHealthBlue;
    myhealth[1] = global.mod_coreErisHealthYellow;
    myhealth[2] = global.mod_coreErisHealthRed;
}
</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>/// Morph sttings.

sizeX = 1;
sizeY = 1;
xtype = sCoreXShell;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="3">
      <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>/// Change X depth after spawning. 

if(instance_exists(inst)) inst.depth = -200;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" 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>/// Reenable X spawning. 

canSpawnX = true;
</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>/// Spawn X parasite.

if(canSpawnX &amp;&amp; state != 0) {
    inst = spawn_rnd_pickup_at(x, y, 100);
    if(instance_exists(inst)) {
        inst.state = 2;
        inst.statetime = 0;
        inst.depth = -151;
    
        canSpawnX = false;
        alarm[2] = 75;
        alarm[3] = 60;
    }
}
</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>/// Create electric sparks.

if(myhealth[2] &gt; 0) {
    if(sparkcount &gt; 0) {
        instance_create(x, y, oElectricSparkCoreXShort);
        sparkcount--;
        alarm[0] = 30 + random(30);
        sfx_play(sndCoreXPhaseShort);
    }
    else {
        instance_create(x, y, oElectricSparkCoreX);
        sparkcount = irandom_range(3, 5);
        alarm[0] = 60 + random(15);
    }
}
</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 movement.

if (state == 0) {
    if(statetime == 0) sfx_play(sndXMorph1);
    if(statetime &lt; 40) {
        sizeX = sizeX + 0.18;
        sizeY = sizeY + 0.12;
    }
    if(statetime &gt;= 40 &amp;&amp; statetime &lt; 80) {
        sizeX = sizeX - 0.18;
        sizeY = sizeY - 0.12;

        if(statetime == 40) {
            sprite_index = xtype;
            depth = -155;
            spawn_rnd_pickup_at(x + lengthdir_x(20,  90 + random_range(-20, 20)), y + lengthdir_y(20,  90 + random_range(-20, 20)), 100);
            spawn_rnd_pickup_at(x + lengthdir_x(20,  18 + random_range(-20, 20)), y + lengthdir_y(20,  18 + random_range(-20, 20)), 100);
            spawn_rnd_pickup_at(x + lengthdir_x(20, 306 + random_range(-20, 20)), y + lengthdir_y(20, 306 + random_range(-20, 20)), 100);
            spawn_rnd_pickup_at(x + lengthdir_x(20, 234 + random_range(-20, 20)), y + lengthdir_y(20, 234 + random_range(-20, 20)), 100);
            spawn_rnd_pickup_at(x + lengthdir_x(20, 162 + random_range(-20, 20)), y + lengthdir_y(20, 162 + random_range(-20, 20)), 100);
        
            if (global.waterlevel != 0) {
                repeat (20) {
                    bubble = instance_create(x, y, oLBubble);
                    if (instance_exists(bubble)) {
                        bubble.hspeed = random_range(-2.5, 2.5);
                        bubble.vspeed = -random(0.4);
                    }
                }
            }
        }
    }
    if(statetime == 80) {
        state = 1;
        statetime = 0;
        alarm[0] = 15;
    }
    image_index = 0;
}
if(state == 1) {
    if (x &gt; oCharacter.x)
        hspeed -= acceleration;
    else 
        hspeed += acceleration;
    
    if (y &gt; oCharacter.y-24) 
        vspeed -= acceleration;
    else                    
        vspeed += acceleration;
    
    if(hspeed &gt; maxspeed) hspeed -= acceleration;
    if(vspeed &gt; maxspeed) vspeed -= acceleration;
    
    if(hspeed &lt; -maxspeed) hspeed += acceleration;
    if(vspeed &lt; -maxspeed) vspeed += acceleration;
    
    friction = drag;
    
    if(myhealth[2] &lt;= 0) {
        state = 100;
        statetime = 0;
    }
    
    if (global.waterlevel != 0) {
        if (fxtimer == 0) {
            bubble = instance_create(x, y, oLBubble);
            if (instance_exists(bubble)) {
                bubble.alarm[0] = 60 + random(120);
                bubble.direction = random(360);
                bubble.speed = 0.5;
            }
        }
    }
}
if(state == 100) {
    if(statetime == 0) {
        hspeed = 0;
        vspeed = 0;
        visible = false;
        sfx_play(sndCoreXBreak);
        
        if(instance_exists(oElectricSparkCoreX)) {
            sfx_stop(sndCoreXPhase);
            with (oElectricSparkCoreX) instance_destroy();
        }
        
        event_user(0);
        event_user(1);
        
        instance_destroy();
    }
}
statetime += 1;

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

if(sizeX &lt; 1) sizeX = 1;
if(sizeY &lt; 1) sizeY = 1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMissile">
      <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>/// Damage Core-X.

var force = 0;
if (!canbehit || state == 0) {
    with (other) event_user(1);
} else {
    with (other) event_user(0);
    if (other.smissile == 0) {
        myhealth[image_index] -= missiledamage;
        force = forcemissile;
        flashing = invulnerability;
    } 
    else {
        myhealth[image_index] -= min(myhealth[image_index], superdamage);
        force = forcesupermissile;
        flashing = invulnerability*superdamage/2;
    }
    
    if(myhealth[image_index] &lt;= 0) image_index++;
    
    if(place_meeting(x, y, oCharacter)) force = -force;
    
    hspeed = lengthdir_x(-force, point_direction(x, y, other.x, other.y));
    vspeed = lengthdir_y(-force, point_direction(x, y, other.x, other.y));
    
    fxtimer = 0;
    canbehit = 0;
    
    if(myhealth[2] &gt; 0) sfx_play(sndCoreXHit);
    
    if (global.waterlevel != 0) {
        repeat (8 + floor(random(4))) {
            bubble = instance_create(x, y, oLBubble);
            if (instance_exists(bubble)) {
                bubble.hspeed = random_range(-2.5, 2.5);
                bubble.vspeed = -random(0.4);
            }
        }
    }
    
    canSpawnX = true;
    alarm[1] = 30;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oBeam">
      <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>/// Fizzle beam.

with (other) {
    event_user(1);
    if (!pbeam) instance_destroy();
}

if (alarm[1] == -1) alarm[1] = 30;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oCharacter">
      <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>/// Damage player.

if (myhealth[2] &gt; 0) {
    if (other.invincible == 0) damage_player(damage, 5, -3, 0, 0);
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="11">
      <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>/// End the boss fight.

if(room == rm_a2a04) {
    with (oDoor) event_user(3);
    mus_fadeout(musArachnus);
    oMusicV2.bossbgm = sndJump;
    mus_current_fadein();
}

if(room == rm_a8a11) {
    with (oDoor) event_user(3);
    mus_fadeout(musGenesis);
    oMusicV2.bossbgm = sndJump;
    mus_current_fadein();
    with (oA8RedLightFX) fadeout = 1;
}

if(room == rm_a3a01) {
    with (oCoreX) alarm[4] = 90;
    with (oTorizoSpikes) event_user(0);
    with (oDoor) event_user(3);
    mus_fadeout(musTorizoB);
    oMusicV2.bossbgm = sndJump;
    mus_current_fadein();
}

if(room == rm_a5b03a) {
    with (oDoorA5) event_user(3);
    mus_fadeout(musEris);
    oMusicV2.bossbgm = sndJump;
    mus_current_fadein();
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="10">
      <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 debris when destryoed. 

deb = instance_create(x-15, y-14, oDebris);
deb.image_angle = 0;
deb.sprite_index = sCoreXShellFrag;
deb.image_index = 0;
deb.direction = 135;
deb.speed = 1 + random_range(-0.1, 0.1);
deb.gravity = 0.5 + random_range(-0.1, 0.1);
deb.depth = -155;
deb.playsound = 0;
deb.rotspeed = 4;
deb.canbounce = 0;
deb.alarm[0] = 30;
deb.alarm[1] = -1;

deb = instance_create(x+15, y-14, oDebris);
deb.image_angle = 0;
deb.sprite_index = sCoreXShellFrag;
deb.image_index = 1;
deb.direction = 45;
deb.speed = 1 + random_range(-0.1, 0.1);
deb.gravity = 0.5 + random_range(-0.1, 0.1);
deb.depth = -155;
deb.playsound = 0;
deb.rotspeed = -4;
deb.canbounce = 0;
deb.alarm[0] = 30;
deb.alarm[1] = -1;

deb = instance_create(x+15, y+14, oDebris);
deb.image_angle = 0;
deb.sprite_index = sCoreXShellFrag;
deb.image_index = 2;
deb.direction = 0;
deb.speed = 0.5 + random_range(-0.1, 0.1);
deb.gravity = 0.5 + random_range(-0.1, 0.1);
deb.depth = -155;
deb.playsound = 0;
deb.rotspeed = 2;
deb.canbounce = 0;
deb.alarm[0] = 30;
deb.alarm[1] = -1;

deb = instance_create(x-15, y+14, oDebris);
deb.image_angle = 0;
deb.sprite_index = sCoreXShellFrag;
deb.image_index = 3;
deb.direction = 180;
deb.speed = 0.5 + random_range(-0.1, 0.1);
deb.gravity = 0.5 + random_range(-0.1, 0.1);
deb.depth = -155;
deb.playsound = 0;
deb.rotspeed = 2;
deb.canbounce = 0;
deb.alarm[0] = 30;
deb.alarm[1] = -1;


bld = instance_create(x+4, y+4, oFXAnimSpark);
bld.sprite_index = sCoreXBlood;
bld.image_speed = 0.35 + random_range(-0.075, 0.075);
bld.image_alpha = 0.8;
bld.image_angle = 45 + irandom_range(-15, 15);
bld.image_xscale = 1;
bld.image_yscale = 1;

bld = instance_create(x+4, y+4, oFXAnimSpark);
bld.sprite_index = sCoreXBlood;
bld.image_speed = 0.35 + random_range(-0.075, 0.075);
bld.image_alpha = 0.8;
bld.image_angle = 135 + irandom_range(-15, 15);
bld.image_xscale = 1;
bld.image_yscale = 1;

bld = instance_create(x+4, y+4, oFXAnimSpark);
bld.sprite_index = sCoreXBlood;
bld.image_speed = 0.35 + random_range(-0.075, 0.075);
bld.image_alpha = 0.8;
bld.image_angle = 315 + irandom_range(-15, 15);
bld.image_xscale = 1;
bld.image_yscale = 1.25;

bld = instance_create(x+4, y+4, oFXAnimSpark);
bld.sprite_index = sCoreXBlood;
bld.image_speed = 0.35 + random_range(-0.075, 0.075);
bld.image_alpha = 0.8;
bld.image_angle = 225 + irandom_range(-15, 15);
bld.image_xscale = 1;
bld.image_yscale = 1;

if (global.waterlevel != 0) {
    repeat (20) {
        bubble = instance_create(x, y, oLBubble);
        if (instance_exists(bubble)) {
            bubble.hspeed = random_range(-2.5, 2.5);
            bubble.vspeed = -random(0.4);
        }
    }
}
</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 = 0)
{ 
    with(oCoreX) draw_sprite_pixelated(sprite_index, image_index, x, y, 1, 1, image_angle, c_white, 1, other.sizeX, other.sizeY, 64);
    if(sprite_index == xtype) 
        draw_sprite_pixelated(sprite_index, image_index, x, y, image_xscale, 1, image_angle, c_white, 1, sizeX, sizeY, 64);
    else {
        if(sprite_index == sErisHead) draw_sprite_pixelated(sErisJaw, 0, lastBossX, lastBossY, 1, lastYscale, lastBossAngle, c_white, 1, sizeX, sizeY, 64);
        
        draw_sprite_pixelated(sprite_index, image_index, lastBossX, lastBossY, lastBossFacing, lastYscale, lastBossAngle, c_white, 1, sizeX, sizeY, 128);
    }
}
else {
    if (flashing) {
        draw_sprite_ext(sprite_index, -1, x, y, image_xscale, 1, 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, 1, image_angle, -1, 1 - fxtimer * 0.25);
        draw_set_blend_mode(bm_normal);
    }
    else 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>
