<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sErisBody1</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</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>init = 0;
flashing = 0;
boosting = 0;
spr_normal = sErisBody1;
spr_frozen = sErisBody1F;
spr_open = sErisBody1D;
shaking = 0;
tail = 0;
canbeX = 1;
//hp = 10;
hp = global.mod_serrisHbody;
//damage = 50;
damage = global.mod_serrisDamage;
// ice check
if ((global.item[11] == 0) &amp;&amp; (!tail)) 
{
    state = 2;
} else {
    state = 0;
}
statetime = 0;
inrange = 0;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="1" 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>/// Health drops

// If Fusion, run regular pickup spawn routines.
if(oControl.mod_fusion) {
    timer = 0;
    rotspeed = 0;
    myspeed = 0;
    offset = 0;
    moveratio = 0;
    movesteps = 0;
    spawn_rnd_pickup(100);
} else { // Otherwise, run Monster pickup spawn routines.
    monster_spawn_powerups(x, y, irandom(4), irandom(3));
}
</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>/// Death routine

make_explosion3(x, y);
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);
    }
}
sfx_play(sndMissileExpl);
instance_destroy();
</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>/// Boost calls

// Check for speedboost...
if (oErisHead.boosting) {
    // Afterimages
    if ((oErisHead.fxtimer == 2) || (oErisHead.fxtimer == 5)) {
        var aft = instance_create(x, y, oFXTrail);
        aft.sprite_index = sprite_index;
        aft.depth = (depth + 5);
        aft.fadespeed = 0.08;
        aft.image_angle = image_angle;
        aft.image_xscale = image_xscale;
        aft.image_yscale = image_yscale;
        aft.additive = 1;
    }
    repeat (irandom(2)) { // May need to come back and optimize for Android, bubbles hurt system performance
        // Bubbles!
        bubble = instance_create(x+irandom_range(-5,5), y+irandom_range(-5,5), oLBubble);
        if (instance_exists(bubble)) { // Seems a bit redundant, I know, but safety third kiddos.
            bubble.direction = point_direction(x, y, xprevious, yprevious) + irandom_range(-35, 35);
            bubble.alarm[0] = 10 + irandom_range(0, 20);
            bubble.speed = 2;
            bubble.eris = 1;
        }
    }
}
</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>/// MOVEMENT

// If not tail...
if ((!tail) &amp;&amp; (state != 100)) {
    // Grab following segment
    var nextSeg = oErisHead.segment[order-1];
    
    // Init code to space segments, probably will scrap
    if (init == 0) {
        nextSeg.x = x + lengthdir_x(sprite_width-2, image_angle-180);
        nextSeg.y = y + lengthdir_y(sprite_width-2, image_angle-180);
        init = 1;
    }
    // Point following segment at self
    nextSeg.image_angle = point_direction(nextSeg.x, nextSeg.y, x, y);
    
    // Move previous segment towards self
    nextSeg.x = lerp(nextSeg.x, x + lengthdir_x(nextSeg.sprite_width-(76/clamp(oErisHead.speed, 1, 16)), image_angle-180), clamp((oErisHead.speed-1)*0.065, 0, 1));
    nextSeg.y = lerp(nextSeg.y, y + lengthdir_y(nextSeg.sprite_width-(76/clamp(oErisHead.speed, 1, 16)), image_angle-180), clamp((oErisHead.speed-1)*0.065, 0, 1));
    
    
}

// If first neck segment, snap to head
if ((order == 14) &amp;&amp; (state != 100)) {
    image_angle = point_direction(x, y, oErisHead.x, oErisHead.y);
}

/// GRAB PARENT VARS

if (state != 100) {
    boosting = oErisHead.boosting;
}

/// STATE MACHINE
inrange = (x &gt; 32) &amp;&amp; (x &lt; 608) &amp;&amp; (y &gt; 48) &amp;&amp; (y &lt; 448);

if (!tail) {
    if (state == 0) { // Awaiting freeze
        sprite_index = spr_normal;
    } else if (state == 1) { // Frozen
        sprite_index = spr_frozen;
        if (statetime &gt;= 600) { // Melt, but ready to refreeze quickly
            state = 0;
            statetime = 0;
            hp = 2;
        }
    } else if (state == 2) { // Vulnerable
        sprite_index = spr_open;
    }
}
if (state == 100) { // Death
    if (statetime &lt; 30) {
        speed *= 0.85;
    } else if (vspeed &gt; -0.2) vspeed -= 0.01;
}
if ((state == 1 ) || (state == 100)) {
    statetime += 1;
}

// Shaking
if (shaking &gt; 0) {
    xoff = random_range(-4, 4);
    yoff = random_range(-4, 4);
    shaking -= 1;
} else {
    xoff = 0;
    yoff = 0;
}

// Flashing
if (flashing &gt; 0) {
    flashing -= 1;
}

//if (oErisHead.boostphase == 1 || oErisHead.boostphase == 3 || oErisHead.boostphase == 5) {
if (boosting) {
    if (flashing &lt;= 1) {
        flashing = 10;
    }
}

</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>/// Effects on missile, explosion does actual damage
if ((inrange) &amp;&amp; (!oErisHead.boosting) &amp;&amp; (!flashing) &amp;&amp; (!tail)) {
    with (other) {
        event_user(0); // Run explosion
    }
} else if (!tail) {
    with (other) {
        event_user(1); // Bounce
    }
}
</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>/// Take Beam damage
if ((inrange) &amp;&amp; (!flashing) &amp;&amp; (!oErisHead.boosting) &amp;&amp; (!tail)) { // Safety check
    if ((state == 0) || (state == 1)) { // Shell up
        if (other.ibeam) { // Freeze
            if (!other.pbeam) { // Buff non-plasma damage
                hp -= 4;
            } else {
                hp -= 2; // Nerf plasma damage
            }
            if (other.chargebeam) {
                hp = 0; // Instantly freeze if other is charge beam
            }
            with (other) {
                event_user(0); // Do thing to the beam
            }
            event_user(0); // Take damage, freeze self if necessary
        } else with (other) {
            event_user(1); // Bounce hits if not ice
        }
        if (!other.pbeam) {
            with (other) {
                instance_destroy(); // Destroy hits if not Plasma
            }
        }
    } else if (state == 2) { // Second phase damage
        with (other) { // Beam handling
            event_user(0);
            if (!pbeam) instance_destroy();
        }
        event_user(3); // Take damage
    }
} else if (!tail) {
    with (other) { // If flashing, boosting, OOB, or tail ignore hits
        if (pbeam) {
            event_user(1);
        } else {
            event_user(0);
            instance_destroy();
        }
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMissileExpl">
      <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>/// Take Missile damage
if ((inrange) &amp;&amp; (!oErisHead.boosting) &amp;&amp; (!tail)) { // Safety check
    if (state == 1) { // If frozen, shatter
        event_user(1);
    } else if ((state == 2) &amp;&amp; (!flashing) &amp;&amp; (other.erisDmg == 1)) { // Else if open, take damage
        if (other.smissile) { // Damage mod for Supers
            event_user(4);
        } else {
            event_user(3);
        }
        with (other) { // Fix for double hits
            erisDmg = 0;
        }
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oPBombExpl">
      <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>/// Take PB damage
if ((inrange) &amp;&amp; (!oErisHead.boosting) &amp;&amp; (!tail)) { // Safety check
    if (state == 1) { // If frozen, shatter
        event_user(1); 
    } else if ((state == 2) &amp;&amp; (!flashing)) { // Else if open, take damage
        event_user(2); 
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oBombExpl">
      <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>/// Take Bomb damage
if ((inrange) &amp;&amp; (!oErisHead.boosting) &amp;&amp; (!tail)) { // Safety check
    if (state == 1) { // If frozen, shatter
        event_user(1); 
    } else if ((state == 2) &amp;&amp; (!flashing)) { // Else if open, take damage
        event_user(2); 
    }
}
</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 Sarah
//if (inrange) { // Safety check?
    if (state != 100) damage_player(damage, 7, -3, 0, 0);
//}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="20">
      <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>/// Call from head to destroy routine

// Randomize drift
direction = image_angle + irandom_range(-20, 20);
speed = 4;
// Prepare to explode
alarm[1] = 200 + irandom(60);
// Destroy state
state = 100; 
statetime = 0;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="15">
      <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>/// Bubbles!
repeat (4 + floor(random(4))) {
    var bubble = instance_create(x, y, oLBubble);
    if (instance_exists(bubble)) {
        bubble.hspeed = random_range(-1, 1);
        bubble.vspeed = -random(0.4);
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="14">
      <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>/// Super Missile damage
if (state != 100) {
    if (instance_exists(oErisHead)) {
        with (oErisHead) {
            hp -= 4;
            stun = 3;
            event_user(2);
        }
    }
    event_user(5); // Bubbles!
    shaking = 8;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="13">
      <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>/// Missile/Beam damage
if (state != 100) {
    if (instance_exists(oErisHead)) {
        with (oErisHead) {
            hp -= 2;
            stun = 2;
            event_user(2);
        }
    }
    event_user(5); // Bubbles!
    shaking = 8;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="12">
      <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>/// Bomb/PB damage
if (state != 100) {
    if (instance_exists(oErisHead)) {
        with (oErisHead) {
            hp -= 1;
            stun = 1;
            event_user(2);
        }
    }
    event_user(5); // Bubbles!
    shaking = 8;
}
</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>/// Ice shatter
if (state != 100) {
    flashing = 10;
    shaking = 8;
    state = 2;
    statetime = 0;
    if (instance_exists(oErisHead)) {
        with (oErisHead) {
            stun = 2;
        }
    }
    PlaySoundMono(sndIceShatter); // Sound
    
    /// Particles
    repeat (8) {
        var deb = instance_create(x, y - 8, oIceShard);
    }
    repeat (8 + irandom(4)) {
        var bubble = instance_create(x, y, oLBubble);
        if (instance_exists(bubble)) {
            bubble.hspeed = random_range(-2.5, 2.5);
            bubble.vspeed = -random(0.4);
        }
    }
    if (global.waterlevel != 0 &amp;&amp; y + 8 &gt; global.waterlevel + global.wateroffset) {
        repeat (8 + irandom(4)) {
            var bubble = instance_create(x, y, oLBubble);
            if (instance_exists(bubble)) {
                bubble.hspeed = random_range(-1.5, 1.5);
                bubble.vspeed = -random(0.4);
            }
        }
    }
}
</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>/// First phase damage
if (state != 100) {
    flashing = 10;
    if (hp &lt;= 0) {
        hp = 0;
        state = 1;
        statetime = 0;
        sfx_stop(sndFreezeHit);
        sfx_play(sndFreezeHit);
    } else sfx_play(sndIceBeamHit);
}
</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();

// Flashing, ice melt flash
if ((flashing &gt; 0) || ((state == 1) &amp;&amp; (statetime &gt; 240))) {
    draw_set_blend_mode(bm_add);
    
    repeat (2) {
        draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, -1, flashing * 0.1);
    }
    
    draw_set_blend_mode(bm_normal);
}

// Speedboosting Draw
if (oErisHead.boosting) {
    draw_set_blend_mode(bm_add);

    if (oErisHead.fxtimer == 0 || oErisHead.fxtimer == 1) {
        draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, c_green, 1.1 + oErisHead.fxtimer * 0.2);
    }
    
    if (oErisHead.fxtimer == 2 || oErisHead.fxtimer == 3) {
        repeat (2) {
            draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, c_yellow, 1);
            draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, c_white, 1);
        }
    }
    
    if (oErisHead.fxtimer == 4 || oErisHead.fxtimer == 5) {
        repeat (2) {
            draw_sprite_ext(sprite_index, -1, x, y, image_xscale, image_yscale, image_angle, c_red, 1);
        }
    }
    
    draw_set_blend_mode(bm_normal);
}

/* debug
draw_self();
draw_text(x, y+16, string(order));
</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>
