<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sMGammaBody</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>canbeX = 0;
makeActive();
setCollisionBounds(-15, -12, 15, 24);
hpush = 5;
vpush = -3;
flashing = 0;
flashtime = 0;
canbehit = 1;
frozen = 0;
platform = 0;
statetime = 0;
turndelay = 0;
currentangle = 0;
targetangle = 0;
rotspeed = 0;
spdelay = 120;
turning = 0;
dodgedelay = 0;
dodgetime = 0;
dodging = 0;
fxtimer = 0;
chasing = 0;
hitsound = sndMGammaHit;
deathsound = sndMGammaDeath;
active = 1;
target = 0;
state = 3;
alarm[1] = 120;
alarm[3] = 1;
damagedealt = 0;
drawefangs = 0;
grabber = -4;
arms = -4;
nextsp = 0;
scan_log(13, get_text("ScanEvents", "ScanBioform"), 180, 0);
legfa1a = 0;
legfa1t = 0;
legfa1da = 0;
legfa2a = 0;
legfa2t = 0;
legfa2da = 0;
legfb1a = 0;
legfb1t = 0;
legfb1da = 0;
legfb2a = 0;
legfb2t = 0;
legfb2da = 0;
legba1a = 0;
legba1t = 0;
legba1da = 0;
legba2a = 0;
legba2t = 0;
legba2da = 0;
legbb1a = 0;
legbb1t = 0;
legbb1da = 0;
legbb2a = 0;
legbb2t = 0;
legbb2da = 0;
legrotspeed = 0;
alarm[9] = 1;
inwater = 0;
speedmulti = 1;
targetx = x;
targety = y;
dead = false;
</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>global.dmap[mapposx, mapposy] = 11;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" 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>repeat (10) {
    expl = instance_create(x - 16 + random(32), y - 16 + random(32), oFXAnimSpark);
    expl.image_speed = 0.5 + random(0.5);
    expl.additive = 0;
    expl.sprite_index = sExpl1;
    expl.direction = random(360);
    expl.speed = 2 + random(1);
}
make_explosion4(x, y);
instance_create(x, y, oScreenFlash);
sfx_play(sndMGammaExpl);
sfx_play(sndMissileExpl);
if (global.monstersalive == 0) mus_current_fadein();
if (oControl.mod_insanitymode == 0 || (global.difficulty &lt; 2 &amp;&amp; oControl.mod_insanitymode == 1)) {
    if (damagedealt &gt; givebackhp) damagedealt = givebackhp;
    monster_spawn_powerups(x, y, floor(damagedealt / 20), floor(starthealth / 10 / 2));
}
instance_destroy();
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" 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>expl = instance_create(x - 16 + random(32), y - 16 + random(32), oFXAnimSpark);
expl.image_speed = 0.5;
expl.additive = 0;
expl.sprite_index = sExpl1;
expl.image_xscale = 0.5;
expl.image_yscale = 0.5;
alarm[10] = 5;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="9">
      <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 (myid == 20) {
    if (global.dmap[57, 31] == 10) global.dmap[57, 31] = 1;
    if (global.dmap[58, 31] == 10) global.dmap[58, 31] = 1;
    if (global.dmap[59, 31] == 10) global.dmap[59, 31] = 1;
}
myposx = floor(x / 320);
myposy = floor((y - 8) / 240);
mapposx = myposx + global.mapoffsetx;
mapposy = myposy + global.mapoffsety;
global.dmap[mapposx, mapposy] = 10;
with (oControl) event_user(2);
</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>if (chasing == 0) {
    chasing = 1;
    alarm[3] = awaydelay;
} else event_user(1);
</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>flash = instance_create(x, y, oFXTrail);
flash.sprite_index = sprite_index;
flash.image_index = image_index;
flash.image_alpha = 1;
flash.white = 0;
flash.fadespeed = 0.15;
flash.depth = 10;
flash.image_xscale = facing;
flash.image_angle = image_angle;
flash = instance_create(x + legfa1x, y + legfa1y, oFXTrail);
flash.sprite_index = sMGammaLegFA1;
flash.image_index = image_index;
flash.image_alpha = 1;
flash.white = 0;
flash.fadespeed = 0.15;
flash.depth = 10;
flash.image_xscale = facing;
flash.image_angle = image_angle + legfa1da;
flash = instance_create(x + legfa1x + legfa2x, y + legfa1y + legfa2y, oFXTrail);
flash.sprite_index = sMGammaLegFA2;
flash.image_index = image_index;
flash.image_alpha = 1;
flash.white = 0;
flash.fadespeed = 0.15;
flash.depth = 10;
flash.image_xscale = facing;
flash.image_angle = image_angle + legfa1da + legfa2da;
flash = instance_create(x + legfb1x, y + legfb1y, oFXTrail);
flash.sprite_index = sMGammaLegFB1;
flash.image_index = image_index;
flash.image_alpha = 1;
flash.white = 0;
flash.fadespeed = 0.15;
flash.depth = 10;
flash.image_xscale = facing;
flash.image_angle = image_angle + legfb1da;
flash = instance_create(x + legfb1x + legfb2x, y + legfb1y + legfb2y, oFXTrail);
flash.sprite_index = sMGammaLegFB2;
flash.image_index = image_index;
flash.image_alpha = 1;
flash.white = 0;
flash.fadespeed = 0.15;
flash.depth = 10;
flash.image_xscale = facing;
flash.image_angle = image_angle + legfb1da + legfb2da;
if (state == 5 || dodging) alarm[2] = 3;
</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>instance_activate_region(x - 64, y - 64, 128, 128, 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>if (active == 1) {
    if (state == 1) {
        xVel = 0;
        yVel = 0;
    }
    if (state == 3) {
        if (chasing) {
            targetx = oCharacter.x;
            targety = oCharacter.y - 32;
            if (shell.hitting &amp;&amp; hitandrun) {
                xVel = 0;
                yVel = 0;
                event_user(1);
                with (shell) hitting = 0;
            }
        } else if (distance_to_object(oCharacter) &gt; 120) {
            chasing = 1;
            alarm[3] = awaydelay;
        }
        if (targety &gt; y) yVel += myaccely * 1.4;
        if (targety - 24 &lt; y) yVel -= myaccely;
        if (targetx &gt; x) xVel += myaccelx;
        if (targetx &lt; x) xVel -= myaccelx;
        if (isCollisionRight(1) &amp;&amp; xVel &gt; 0 || isCollisionLeft(1) &amp;&amp; xVel &lt; 0) xVel = 0;
        if (isCollisionBottom(1) &amp;&amp; yVel &gt; 0 || isCollisionTop(1) &amp;&amp; yVel &lt; 0) yVel = 0;
        rotspeed = 0.5;
        if (abs(xVel) &gt; 1) {
            targetangle = -abs(xVel) * 3;
        } else targetangle = 0;
        legrotspeed = 1;
        legfa1t = -abs(xVel) * 4;
        legfb1t = -abs(xVel) * 4;
        legba1t = -abs(xVel) * 4;
        legbb1t = -abs(xVel) * 4;
        legfa2t = abs(xVel) * 9;
        legfb2t = abs(xVel) * 9;
        legba2t = abs(xVel) * 9;
        legbb2t = abs(xVel) * 9;
        if ((canspmove || canspmove2) &amp;&amp; statetime &gt; 60 &amp;&amp; spdelay == 0 &amp;&amp; dodging == 0) {
            nextsp = 0;
            if (random(1) &lt; 0.5) {
                if (canspmove) nextsp = 1;
            } else if (canspmove2) nextsp = 2;
            if (nextsp == 1) {
                state = 7;
                spdelay = 180;
                statetime = 0;
                turndelay = 5;
            } else if (nextsp == 2) {
                state = 4;
                spdelay = 150;
                statetime = 0;
                turndelay = 5;
            }
        }
        if (candodge &amp;&amp; dodgedelay == 0 &amp;&amp; (instance_exists(oMissile) &amp;&amp; distance_to_object(oMissile) &lt; 64 || instance_exists(oBeam) &amp;&amp; distance_to_object(oBeam) &lt; 64) &amp;&amp; (facing == 1 &amp;&amp; oCharacter.x &gt; x || facing == -1 &amp;&amp; oCharacter.x &lt; x)) {
            if (oCharacter.y - 48 &gt; y) {
                yVel = 2.5;
                if (oCharacter.x &gt; x) xVel = -3.5;
                if (oCharacter.x &lt; x) xVel = 3.5;
            }
            if (oCharacter.y - 48 &lt; y) {
                yVel = -4;
                if (oCharacter.x &gt; x) xVel = 1;
                if (oCharacter.x &lt; x) xVel = -1;
            }
            dodging = 1;
            dodgetime = 0;
            dodgedelay = 300;
            alarm[2] = 1;
            currentangle = -10;
            canbehit = 0;
            sfx_play(sndMGammaDodge);
        }
        if (dodging &amp;&amp; dodgetime &gt;= 8) {
            dodging = 0;
            canbehit = 1;
        }
    } // if (state == 3)
    if (state == 4) {
        if (oCharacter.y - 48 &gt; y) yVel += 0.4;
        if (oCharacter.y - 48 &lt; y) yVel += -0.2;
        if (oCharacter.y - 80 &gt; y) yVel *= 0.95;
        if (distance_to_object(oCharacter) &lt; 128) {
            if (oCharacter.x &gt; x) xVel += -0.1;
            if (oCharacter.x &lt; x) xVel += 0.1;
        }
        xVel *= 0.98;
        rotspeed = 0.5;
        targetangle = -20;
        legrotspeed = 0.5;
        legfa1t = -30;
        legfb1t = -30;
        legba1t = -30;
        legbb1t = -30;
        legfa2t = 40;
        legfb2t = 40;
        legba2t = 40;
        legbb2t = 40;
        if (statetime &gt; 50) {
            state = 5;
            statetime = 0;
            turndelay = 70;
            alarm[2] = 1;
            sfx_play(sndMGammaSP);
        }
    } // if (state == 4)
    if (state == 5) {
        if (statetime &lt; 10) xVel *= 0.98;
        if (statetime == 10) {
            if (oCharacter.x &gt; x) xVel = 6;
            if (oCharacter.x &lt; x) xVel = -6;
            yVel = 0;
            grabber = instance_create(x, y, oMGammaGrab);
        }
        if (oCharacter.y - 54 &gt; y) yVel += 0.2;
        if (oCharacter.y - 64 &lt; y) yVel += -0.2;
        if (isCollisionBottom(1) &amp;&amp; yVel &gt; 0 || isCollisionTop(1) &amp;&amp; yVel &lt; 0) yVel = 0;
        if (yVel &gt; 2) yVel = 2;
        if (yVel &lt; -2) yVel = -2;
        rotspeed = 0.5;
        targetangle = -8;
        legrotspeed = 2;
        legfa1t = -20;
        legfb1t = -20;
        legba1t = -20;
        legbb1t = -20;
        legfa2t = -30;
        legfb2t = -30;
        legba2t = -30;
        legbb2t = -30;
        if (statetime &gt; 60) {
            state = 3;
            statetime = 0;
            turndelay = 30;
            canbehit = 1;
        }
        if (statetime &gt; 10 &amp;&amp; (isCollisionRight(1) || isCollisionLeft(1))) {
            state = 6;
            statetime = 0;
            turndelay = 60;
            with (grabber) instance_destroy();
        }
        if (oCharacter.state == 38) {
            state = 9;
            statetime = 0;
            canbehit = 1;
        }
    } // if (state == 5)
    if (state == 6) {
        xVel = 0;
        yVel = 0;
        rotspeed = 0.25;
        targetangle = 0;
        if (statetime &gt; 30) {
            state = 3;
            statetime = 0;
            turndelay = 10;
        }
    }
    if (state == 7) {
        xVel = 0;
        yVel = 0;
        rotspeed = 0.5;
        targetangle = 0;
        legrotspeed = 2;
        legfa1t = 20;
        legfb1t = 20;
        legba1t = 20;
        legbb1t = 20;
        legfa2t = 40;
        legfb2t = 40;
        legba2t = 40;
        legbb2t = 40;
        if (statetime == 5) sfx_play(sndMGammaSP2);
        if (statetime &gt; 30) {
            state = 8;
            statetime = 0;
        }
    }
    if (state == 8) {
        xVel = 0;
        yVel = 0;
        rotspeed = 0.5;
        targetangle = 0;
        legrotspeed = 5;
        legfa1t = -20;
        legfb1t = -20;
        legba1t = -20;
        legbb1t = -20;
        legfa2t = -30;
        legfb2t = -30;
        legba2t = -30;
        legbb2t = -30;
        if (statetime == 4) {
            elec = instance_create(x + 32 * facing, y, oMGammaElec);
            elec.facing = facing;
            elec.rotspeed = elecrotspeed;
            if (facing == 1) elec.image_angle = -130;
            if (facing == -1) elec.image_angle = 310;
            sfx_play(sndMGammaElec);
        }
        if (statetime &gt; 15 &amp;&amp; !instance_exists(oMGammaElec)) {
            state = 3;
            statetime = 0;
            turndelay = 10;
            yVel = -0.5;
        }
    } // if (state == 8)
    if (state == 9) {
        if (facing == 1 &amp;&amp; xVel &gt; -1.5) xVel -= 0.05;
        if (facing == -1 &amp;&amp; xVel &lt; 1.5) xVel += 0.05;
        yVel = -0.5;
        rotspeed = 0.2;
        targetangle = 10;
        legrotspeed = 1;
        legfa1t = 20;
        legfb1t = 20;
        legba1t = 20;
        legbb1t = 20;
        legfa2t = 10;
        legfb2t = 10;
        legba2t = 10;
        legbb2t = 10;
        if (statetime == 0) {
            spark = instance_create(oCharacter.x, oCharacter.y, oElectricSpark);
            arms = instance_create(x, y, oMGammaArms);
            if (global.difficulty &gt;= 2) xVel *= 0.5;
        }
        spark.image_alpha = 1;
        if (statetime &gt; 100) {
            state = 3;
            statetime = 0;
            turndelay = 10;
            with (arms) instance_destroy();
        }
    } // if (state == 9)
    if (oCharacter.x &gt; x &amp;&amp; facing == -1 &amp;&amp; (state == 3 || state == 4)) {
        if (turndelay &gt; 0) turndelay -= 1;
        if (turndelay == 0) {
            facing = 1;
            turndelay = 5;
            turning = 1;
            myspr = sprite_index;
            sprite_index = sMGammaTurn;
            image_index = 0;
        }
    }
    if (oCharacter.x &lt; x &amp;&amp; facing == 1 &amp;&amp; (state == 3 || state == 4)) {
        if (turndelay &gt; 0) turndelay -= 1;
        if (turndelay == 0) {
            facing = -1;
            turndelay = 5;
            turning = 1;
            myspr = sprite_index;
            sprite_index = sMGammaTurn;
            image_index = 0;
        }
    }
    if (turning) {
        image_speed = 0.5;
    } else image_speed = 0.5;
    if (flashing) {
        if (statetime == 0) {
            if (oCharacter.x &gt; x) xVel = -2;
            if (oCharacter.x &lt; x) xVel = 2;
            yVel = -2;
            dodgedelay = 20;
            spdelay = 40;
            with (oMGammaElec) instance_destroy();
            if (myhealth &gt; 0) state = 3;
        }
        if (isCollisionRight(1) &amp;&amp; xVel &gt; 0 || isCollisionLeft(1) &amp;&amp; xVel &lt; 0) xVel *= -1;
        xVel *= 0.95;
        yVel *= 0.95;
        rotspeed = 2;
        targetangle = 0;
        legrotspeed = 2;
        legfa1a = 20;
        legfa1t = 0;
        legfb1a = 20;
        legfb1t = 0;
        legfa2a = 40;
        legfa2t = 0;
        legfb2a = 40;
        legfb2t = 0;
        legba1a = 20;
        legba1t = 0;
        legbb1a = 20;
        legbb1t = 0;
        legba2a = 40;
        legba2t = 0;
        legbb2a = 40;
        legbb2t = 0;
        if (statetime &gt;= flashtime) {
            canbehit = 1;
            flashing = 0;
            statetime = 0;
        }
    } // if (flashing)
    if (state != 5) {
        if (yVel &gt; maxspeedy) yVel = maxspeedy;
        if (yVel &lt; -maxspeedy) yVel = -maxspeedy;
        if (xVel &gt; maxspeedx) xVel = maxspeedx;
        if (xVel &lt; -maxspeedx) xVel = -maxspeedx;
    }
    if (currentangle &gt; targetangle) currentangle -= rotspeed;
    if (currentangle &lt; targetangle) currentangle += rotspeed;
    image_angle = currentangle * facing;
    if (legfa1a &gt; legfa1t) legfa1a -= legrotspeed;
    if (legfa1a &lt; legfa1t) legfa1a += legrotspeed;
    if (legfa2a &gt; legfa2t) legfa2a -= legrotspeed;
    if (legfa2a &lt; legfa2t) legfa2a += legrotspeed;
    if (legfb1a &gt; legfb1t) legfb1a -= legrotspeed;
    if (legfb1a &lt; legfb1t) legfb1a += legrotspeed;
    if (legfb2a &gt; legfb2t) legfb2a -= legrotspeed;
    if (legfb2a &lt; legfb2t) legfb2a += legrotspeed;
    if (legba1a &gt; legba1t) legba1a -= legrotspeed;
    if (legba1a &lt; legba1t) legba1a += legrotspeed;
    if (legba2a &gt; legba2t) legba2a -= legrotspeed;
    if (legba2a &lt; legba2t) legba2a += legrotspeed;
    if (legbb1a &gt; legbb1t) legbb1a -= legrotspeed;
    if (legbb1a &lt; legbb1t) legbb1a += legrotspeed;
    if (legbb2a &gt; legbb2t) legbb2a -= legrotspeed;
    if (legbb2a &lt; legbb2t) legbb2a += legrotspeed;
    legfa1da = legfa1a * facing;
    legfa2da = legfa2a * facing;
    legfb1da = legfb1a * facing;
    legfb2da = legfb2a * facing;
    legba1da = legba1a * facing;
    legba2da = legba2a * facing;
    legbb1da = legbb1a * facing;
    legbb2da = legbb2a * facing;
    if (global.waterlevel != 0 &amp;&amp; y &gt; global.waterlevel) {
        inwater = 1;
    } else inwater = 0;
    if (inwater) {
        speedmulti = 0.6;
    } else speedmulti = 1;
    moveTo(xVel * speedmulti, yVel * speedmulti);
} // if (active == 1)
if (state == 100) {
    with (shell) instance_destroy();
    xVel *= 0.98;
    yVel *= 0.98;
}
if (instance_exists(shell)) {
    shell.x = x;
    shell.y = y;
    shell.image_xscale = facing;
    shell.image_angle = image_angle;
}
statetime += 1;
if (spdelay &gt; 0) spdelay -= 1;
if (dodgedelay &gt; 0) dodgedelay -= 1;
if (dodging) dodgetime += 1;
if (fxtimer &lt; 5) {
    fxtimer += 1;
} else fxtimer = 0;
drawefangs = !drawefangs;
legfa1x = lengthdir_x(4, currentangle + 330) * facing;
legfa1y = lengthdir_y(4, currentangle + 330);
legfa2x = lengthdir_x(24, currentangle + legfa1a + 255) * facing;
legfa2y = lengthdir_y(24, currentangle + legfa1a + 255);
legfb1x = lengthdir_x(10, currentangle + 217) * facing;
legfb1y = lengthdir_y(10, currentangle + 217);
legfb2x = lengthdir_x(18, currentangle + legfb1a + 230) * facing;
legfb2y = lengthdir_y(18, currentangle + legfb1a + 230);
legba1x = lengthdir_x(16, currentangle + 294) * facing;
legba1y = lengthdir_y(16, currentangle + 294);
legba2x = lengthdir_x(9, currentangle + legba1a + 265) * facing;
legba2y = lengthdir_y(9, currentangle + legba1a + 265);
legbb1x = lengthdir_x(14, currentangle + 230) * facing;
legbb1y = lengthdir_y(14, currentangle + 230);
legbb2x = lengthdir_x(12, currentangle + legfb1a + 256) * facing;
legbb2y = lengthdir_y(12, currentangle + legfb1a + 256);
if (instance_exists(grabber)) {
    grabber.x = x + legba1x + legba2x;
    grabber.y = y + legba1y + legba2y;
    if (state != 5) with (grabber) instance_destroy();
}

if(global.metdead[myid] == 1 &amp;&amp; !dead){
    myhealth = 0;
    state = 100;
    statetime = 0;
    alarm[10] = 1;
    alarm[11] = 160;
    flashtime = 180;
    turndelay = 180;
    PlaySoundMono(deathsound);
    check_areaclear();
    global.monstersalive -= 1;
    if(global.monstersalive &lt; 0){
        global.monstersalive = 0;
    }
    if (global.monstersalive == 0) {
        mus_fadeout(musGammaFight);
        oMusicV2.bossbgm = sndJump;
    }
    if (instance_exists(grabber)) with (grabber) instance_destroy();
    if (instance_exists(arms)) with (arms) instance_destroy();
    if (instance_exists(shell)) with (shell) instance_destroy();
    global.dmap[mapposx, mapposy] = 11;
    with (oControl) event_user(2);
    dead = true;
    xVel = 0;
    yVel = 0;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMStopDown">
      <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 (yVel &gt; 0) yVel *= -0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMStopUp">
      <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 (yVel &lt; 0) yVel *= -0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMStopLeft">
      <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 (xVel &lt; 0) xVel *= -0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMStopRight">
      <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 (xVel &gt; 0) xVel *= -0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMMoverAccelH">
      <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>xVel *= 1.1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMMoverDown">
      <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 == 3) yVel += 1;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMMoverUp">
      <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 == 3) yVel += -0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMMoverRight">
      <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 == 3) xVel += 0.2;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="oMMoverLeft">
      <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 == 3) xVel += -0.2;
</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>if (canbehit) {
    if (state != 7) {
        event_user(0);
        with (other) event_user(0);
    } else with (other) event_user(1);
}
</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>if (oBeam.chargebeam &amp;&amp; !oBeam.ibeam &amp;&amp; !oBeam.wbeam &amp;&amp; !oBeam.pbeam &amp;&amp; !oBeam.sbeam &amp;&amp; global.missiles == 0 &amp;&amp; global.smissiles == 0) {
    if (canbehit) {
        if (state != 7) {
            event_user(0);
            with (other) event_user(0);
        } else with (other) event_user(1);
    }
}
</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>if (myhealth &gt; 0) {
    if (other.invincible == 0) damagedealt += damage;
    damage_player(damage, hpush, vpush, 0, 0);
    if (chasing &amp;&amp; hitandrun) {
        xVel = 0;
        yVel = 0;
        event_user(1);
    }
}
</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>legfa1x = lengthdir_x(4, currentangle + 330) * facing;
legfa1y = lengthdir_y(4, currentangle + 330);
legfa2x = lengthdir_x(24, currentangle + 255) * facing;
legfa2y = lengthdir_y(24, currentangle + 255);
legfb1x = lengthdir_x(10, currentangle + 217) * facing;
legfb1y = lengthdir_y(10, currentangle + 217);
legfb2x = lengthdir_x(18, currentangle + 230) * facing;
legfb2y = lengthdir_y(18, currentangle + 230);
legba1x = lengthdir_x(16, currentangle + 294) * facing;
legba1y = lengthdir_y(16, currentangle + 294);
legba2x = lengthdir_x(9, currentangle + 265) * facing;
legba2y = lengthdir_y(9, currentangle + 265);
legbb1x = lengthdir_x(14, currentangle + 230) * facing;
legbb1y = lengthdir_y(14, currentangle + 230);
legbb2x = lengthdir_x(12, currentangle + 256) * facing;
legbb2y = lengthdir_y(12, currentangle + 256);
</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>chasing = 0;
targetx = oCharacter.x + awayoffsetx * facing;
targety = oCharacter.y + awayoffsety;
alarm[3] = chasedelay;
</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>if (other.smissile == 1) {
    dmg = 50;
    flashtime = 60;
} else {
    dmg = 10;
    flashtime = 30;
}
myhealth -= dmg;
if (myhealth &lt;= 0) {
    state = 100;
    statetime = 0;
    alarm[10] = 1;
    alarm[11] = 160;
    flashtime = 180;
    turndelay = 180;
    PlaySoundMono(deathsound);
    global.metdead[myid] = 1;
    global.monstersleft -= 1;
    global.monstersarea -= 1;
    check_areaclear();
    global.monstersalive -= 1;
    if (global.monstersalive == 0) {
        mus_fadeout(musGammaFight);
        oMusicV2.bossbgm = sndJump;
    }
    if (instance_exists(grabber)) with (grabber) instance_destroy();
    if (instance_exists(arms)) with (arms) instance_destroy();
    global.dmap[mapposx, mapposy] = 11;
    with (oControl) event_user(2);
    dead = true;
}
flashing = 1;
canbehit = 0;
statetime = 0;
currentangle = 30;
if (chasing == 0) {
    chasing = 1;
    alarm[3] = awaydelay;
}
if (myhealth &gt; 0) PlaySoundMono(hitsound);
if (sfx_isplaying(sndMAlphaIntro)) sfx_stop(sndMAlphaIntro);
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="7">
      <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 (turning) {
    turning = 0;
    sprite_index = myspr;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="5">
      <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.ingame == 1) {
    global.monstersalive = 0;
    mus_stop(musGammaFight);
    with (oMusicV2) {
        alarm[2] = -1;
        bossbgm = sndJump;
    }
    mus_current_fadein();
}
</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>
if(oControl.mod_fusion == 1 || oControl.MonsterPalettesFusionOnly == 0) {
    pal_swap_set(oControl.GammaPalette, 1, false);
}

if (!flashing) {
    if (!turning) {
        draw_sprite_ext(sMGammaLegBA1, -1, x + legba1x, y + legba1y, facing, 1, image_angle + legba1da, -1, 1);
        draw_sprite_ext(sMGammaLegBA2, -1, x + legba1x + legba2x, y + legba1y + legba2y, facing, 1, image_angle + legba1da + legba2da, -1, 1);
        draw_sprite_ext(sMGammaLegBB1, -1, x + legbb1x, y + legbb1y, facing, 1, image_angle + legbb1da, -1, 1);
        draw_sprite_ext(sMGammaLegBB2, -1, x + legbb1x + legbb2x, y + legbb1y + legbb2y, facing, 1, image_angle + legbb1da + legbb2da, -1, 1);
    }
    draw_sprite_ext(sprite_index, -1, x, y, facing, 1, image_angle, -1, 1);
    if (!turning) {
        draw_sprite_ext(sMGammaLegFA1, -1, x + legfa1x, y + legfa1y, facing, 1, image_angle + legfa1da, -1, 1);
        draw_sprite_ext(sMGammaLegFA2, -1, x + legfa1x + legfa2x, y + legfa1y + legfa2y, facing, 1, image_angle + legfa1da + legfa2da, -1, 1);
        draw_sprite_ext(sMGammaLegFB1, -1, x + legfb1x, y + legfb1y, facing, 1, image_angle + legfb1da, -1, 1);
        draw_sprite_ext(sMGammaLegFB2, -1, x + legfb1x + legfb2x, y + legfb1y + legfb2y, facing, 1, image_angle + legfb1da + legfb2da, -1, 1);
    }
}
if (flashing) {
    if (!turning) {
        draw_sprite_ext(sMGammaLegBA1, -1, x + legba1x, y + legba1y, facing, 1, image_angle + legba1da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegBA2, -1, x + legba1x + legba2x, y + legba1y + legba2y, facing, 1, image_angle + legba1da + legba2da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegBB1, -1, x + legbb1x, y + legbb1y, facing, 1, image_angle + legbb1da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegBB2, -1, x + legbb1x + legbb2x, y + legbb1y + legbb2y, facing, 1, image_angle + legbb1da + legbb2da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
    }
    draw_sprite_ext(sprite_index, -1, x, y, facing, 1, image_angle, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
    if (!turning) {
        draw_sprite_ext(sMGammaLegFA1, -1, x + legfa1x, y + legfa1y, facing, 1, image_angle + legfa1da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegFA2, -1, x + legfa1x + legfa2x, y + legfa1y + legfa2y, facing, 1, image_angle + legfa1da + legfa2da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegFB1, -1, x + legfb1x, y + legfb1y, facing, 1, image_angle + legfb1da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_sprite_ext(sMGammaLegFB2, -1, x + legfb1x + legfb2x, y + legfb1y + legfb2y, facing, 1, image_angle + legfb1da + legfb2da, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
    }
    draw_set_blend_mode(bm_add);
    repeat (2) {
        if (!turning) {
            draw_sprite_ext(sMGammaLegBA1, -1, x + legba1x, y + legba1y, facing, 1, image_angle + legba1da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegBA2, -1, x + legba1x + legba2x, y + legba1y + legba2y, facing, 1, image_angle + legba1da + legba2da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegBB1, -1, x + legbb1x, y + legbb1y, facing, 1, image_angle + legbb1da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegBB2, -1, x + legbb1x + legbb2x, y + legbb1y + legbb2y, facing, 1, image_angle + legbb1da + legbb2da, -1, 1 - fxtimer * 0.25);
        }
        draw_sprite_ext(sprite_index, -1, x, y, facing, 1, image_angle, -1, 1 - fxtimer * 0.25);
        if (!turning) {
            draw_sprite_ext(sMGammaLegFA1, -1, x + legfa1x, y + legfa1y, facing, 1, image_angle + legfa1da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegFA2, -1, x + legfa1x + legfa2x, y + legfa1y + legfa2y, facing, 1, image_angle + legfa1da + legfa2da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegFB1, -1, x + legfb1x, y + legfb1y, facing, 1, image_angle + legfb1da, -1, 1 - fxtimer * 0.25);
            draw_sprite_ext(sMGammaLegFB2, -1, x + legfb1x + legfb2x, y + legfb1y + legfb2y, facing, 1, image_angle + legfb1da + legfb2da, -1, 1 - fxtimer * 0.25);
        }
    }
    draw_set_blend_mode(bm_normal);
} // if (flashing)
if (state == 8 &amp;&amp; drawefangs) {
    draw_set_blend_mode(bm_add);
    draw_sprite_ext(sMGammaFangs, -1, x, y, facing, 1, image_angle, -1, 1);
    draw_set_blend_mode(bm_normal);
}

shader_reset();
</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>
