<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sMOmega_Body</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;
omega_head = ds_map_find_value(global.omega_types, room);
omega_head_roar = asset_get_index(sprite_get_name(omega_head) + "_Roar");
roar_frame = 0;


if(omega_head == sMOmega_Head_Fusion) omega_body = sMOmega_Body_Spines;
else omega_body = sMOmega_Body;
makeActive();
setCollisionBounds(-10, -30, 10, 46);
myhealth = 350; // 320 previously
myhealth = global.mod_omegahealth;
flashing = 0;
stunned = 0;
fxtimer = 0;
canbehit = 1;
hpush = 7;
vpush = -3;
damage = 100;
damage = global.mod_omegadamage;
damagedealt = 0;
givebackhp = 300;
starthealth = myhealth;
hits_taken = 0;
roaring = 0;
limit_right = 448;
limit_left = 192;
targetx2 = room_width / 2;
target_mode = 0;
mask_obj = instance_create(x, y, oMOmegaMask);
mask2_obj = instance_create(x, y, oMOmegaMask2);
mask3_obj = instance_create(x, y, oMOmegaMask3);
mask4_obj = instance_create(x, y, oMOmegaMask4);
grab_obj = -4;
surf = surface_create(200, 160);
surf_x = 100;
surf_y = 100;
image_speed = 0;
facing = 1;
state = 0;
statetime = 0;
xoff = 0;
yoff = 0;
body_spr = omega_body;
body_frame = 0;
body_x = 0;
body_y = 0;
body_angle = 0;
body_angle_base = 0;
body_target_angle = 0;
body_angle_max = 25;
body_angle_min = -35;
body_shake = 0;
eyes_frame = -1;
eyes_close = 0;
head_obj = instance_create(x, y, oMOmegaHead);
head_spr = omega_head;
head_follow = 1;
head_frame = 0;
head_x = 0;
head_y = 0;
head_xoff = 0;
head_yoff = 0;
head_len = 72;
head_dir = 44;
head_angle = 0;
head_target_angle = 0;
head_angle_max = 45;
head_angle_min = -45;
head_shake = 0;
mouth_x = 0;
mouth_y = 0;
mouth_len = 21;
mouth_dir = -77;
farm_spr = sMOmega_FArm;
farm_frame = 0;
farm_x = 0;
farm_y = 0;
farm_xoff = 0;
farm_len = 37;
farm_dir = 55;
farm_shake = 0;
barm_spr = sMOmega_BArm;
barm_frame = 0;
barm_x = 0;
barm_y = 0;
barm_xoff = 0;
barm_len = 48;
barm_dir = 35;
barm_shake = 0;
fleg_spr = sMOmega_FLeg;
fleg_frame = 0;
fleg_x = 0;
fleg_y = 0;
fleg_xoff = 0;
fleg_yoff = 0;
fleg_shake = 0;
bleg_spr = sMOmega_BLeg;
bleg_frame = 0;
bleg_x = 0;
bleg_y = 0;
bleg_xoff = 0;
bleg_yoff = 0;
bleg_shake = 0;
legx = 0;
legy = 0;
tail = instance_create(x, y, oMOmegaTail);
tail_len = 17;
tail_dir = 163;
targetx = 0;
targety = 0;
alarm[9] = 1;
dmg = 0;
flashtime = 0;
laststate = 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>event_user(2);
with (tail) instance_destroy();
</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);
}
with (tail) instance_destroy();
make_explosion4(x, y);
instance_create(x, y, oScreenFlash);
sfx_play(sndMissileExpl);
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 - 40 + random(80), y - 5 + random(40), 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 (global.metdead[myid] &gt; 0) {
    event_user(2);
    with (tail) instance_destroy();
    instance_destroy();
}
</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>var prj;
prj = instance_create(x - surf_x + mouth_x, y - surf_y + mouth_y, oMOmegaFlame);
prj.speed = 5;
prj.direction = body_angle + (head_dir + mouth_dir) * facing + head_angle;
if (facing == -1) prj.direction += 180;
if (state == 5) {
    if (statetime &lt; 50) alarm[0] = 3;
}
else if (state == 6) {
    if (statetime &lt; 160) alarm[0] = 3;
}
else if (state == 11) {
    if (statetime &lt; 80) alarm[0] = 3;
}
</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>event_user(10);
if (instance_exists(head_obj)) {
    head_obj.x = x - surf_x + xoff + head_x;
    head_obj.y = y - surf_y + yoff + head_y;
    head_obj.facing = facing;
    head_obj.image_angle = body_angle + head_angle;
    head_obj.image_xscale = facing;
}
if (instance_exists(mask_obj)) {
    mask_obj.x = x + xoff;
    mask_obj.y = y + yoff;
    mask_obj.image_xscale = facing;
    mask_obj.image_angle = image_angle;
}
if (instance_exists(mask2_obj)) {
    mask2_obj.x = x + xoff;
    mask2_obj.y = y + yoff;
    mask2_obj.image_xscale = facing;
    mask2_obj.image_angle = image_angle;
}
if (instance_exists(mask3_obj)) {
    mask3_obj.x = x + xoff;
    mask3_obj.y = y + yoff;
    mask3_obj.image_xscale = facing;
    mask3_obj.image_angle = image_angle;
}
if (instance_exists(mask4_obj)) {
    mask4_obj.x = x + xoff;
    mask4_obj.y = y + yoff;
}
if (instance_exists(tail)) {
    tail.facing = facing;
    tail.x = x + lengthdir_x(tail_len * facing, body_angle + tail_dir * facing);
    tail.y = y + yoff + lengthdir_y(tail_len * facing, body_angle + tail_dir * facing);
}
if (instance_exists(grab_obj)) {
    grab_obj.x = x + 70 * facing;
    grab_obj.y = y;
}
</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>var slash_dist, msl, tl;
slash_dist = 130;
// Target set
if (target_mode == 0) {
    targetx = oCharacter.x;
    targety = oCharacter.y;
} else if (target_mode == 1) {
    targetx = targetx2;
    targety = y;
}

// Limits/changes
if (target_mode == 0 &amp;&amp; (facing == 1 &amp;&amp; x &gt; limit_right || facing == -1 &amp;&amp; x &lt; limit_left)) target_mode = 1;

image_xscale = facing;

// States

// Gravity?
if (isCollisionBottom(1) == 0) {
    yVel += 0.2;
} else if (yVel &gt; 0) yVel = 0;

// Standing
if (state == 0) {
    body_frame = 0;
    head_frame = 0;
    fleg_spr = sMOmega_FLeg;
    bleg_spr = sMOmega_BLeg;
    farm_spr = sMOmega_FArm;
    barm_spr = sMOmega_BArm;
    head_spr = omega_head;
    bleg_frame = 0;
    fleg_frame = 0;
    farm_frame = 0;
    barm_frame = 0;
    yoff = 0;
    head_follow = 1;
    
    if (point_distance(x, y, oCharacter.x, y) &lt; (160 + (oControl.widescreen_space/2))) event_user(1);
    
    if (instance_exists(oMissile)) {
        msl = instance_nearest(x, y, oMissile);
        if (distance_to_object(msl) &lt; 60) event_user(1);
    }
    
    if (instance_exists(oBeam)) {
        msl = instance_nearest(x, y, oBeam);
        if (distance_to_object(msl) &lt; 60) event_user(1);
    }
    
    if (statetime == 520 || statetime == 1200) eyes_close = 15;
}

// Walking
if (state == 1) {
    if (statetime == 0) {
        body_target_angle = -10;
        fleg_spr = sMOmega_FLeg_Walk;
        bleg_spr = sMOmega_BLeg_Walk;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_yoff = 0;
        head_follow = 1;
        head_frame = 0;
    }
    
    // Swap to turn state
    if (targetx &lt; x &amp;&amp; facing == 1 || targetx &gt;= x &amp;&amp; facing == -1 &amp;&amp; statetime == 40) {
        state = 2;
        statetime = 0;
    }
    // X offsets
    if (facing == 1 &amp;&amp; isCollisionRight(50) == 0 || facing == -1 &amp;&amp; isCollisionLeft(50) == 0) {
        if (statetime == 3) x += 3 * facing;
        if (statetime == 5) x += 3 * facing;
        if (statetime == 8) x += 3 * facing;
        if (statetime == 11) x += 3 * facing;
        if (statetime == 13) x += 3 * facing;
        if (statetime == 15) x += 3 * facing;
        if (statetime == 18) x += 3 * facing;
        if (statetime == 20) x += 4 * facing;
        if (statetime == 23) x += 4 * facing;
        if (statetime == 25) x += 4 * facing;
        if (statetime == 28) x += 4 * facing;
        if (statetime == 30) x += 4 * facing;
        if (statetime == 32) x += 2 * facing;
        if (statetime == 36) x += 2 * facing;
        if (statetime == 44) x += 2 * facing;
    }
    // Step sound
    if (fleg_frame &gt;= 3 &amp;&amp; fleg_frame &lt; 3.25 || fleg_frame &gt;= 14 &amp;&amp; fleg_frame &lt; 14.25) {
        sfx_play(sndMZetaFootstep);
        screen_shake(5, 2);
        farm_frame = 3;
    }
    if (farm_frame &gt; 0) farm_frame -= 0.25;
    barm_frame = farm_frame;
    fleg_frame = anim_frame_cycle(fleg_spr, fleg_frame, 0.4);
    if (fleg_frame &lt; 13) bleg_frame = fleg_frame;
    // Walk animation
    // Yes, this could be optimized further. No, I don't want to risk screwing up Doc's code.
    switch(floor(fleg_frame)) {
        case 0: {
            yoff = 0;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 1: {
            yoff = -1;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 2: {
            yoff = -2;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 3:
        case 4: {
            yoff = -3;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 5: {
            yoff = -2;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 6: {
            yoff = -1;
            head_yoff = 1;
            farm_frame = 1;
            barm_frame = 1;
            break;
        }
        case 7: {
            yoff = 0;
            head_yoff = 2;
            farm_frame = 2;
            barm_frame = 2;
            break;
        }
        case 8: {
            yoff = -1;
            head_yoff = 2;
            farm_frame = 2;
            barm_frame = 2;
            break;
        }
        case 9: {
            yoff = -2;
            head_yoff = 1;
            farm_frame = 1;
            barm_frame = 1;
            break;
        }
        case 10: {
            yoff = -3;
            head_yoff = 1;
            farm_frame = 1;
            barm_frame = 1;
            break;
        }
        case 11: {
            yoff = -2;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 12: {
            yoff = -1;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            break;
        }
        case 13: {
            bleg_spr = sMOmega_BLeg;
            bleg_frame = 0;
            bleg_xoff = 8;
            yoff = 0;
            head_yoff = 0;
            break;
        }
        case 14: {
            yoff = 0;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            bleg_xoff = 6;
            break;
        }
        case 15: {
            yoff = 0;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            bleg_xoff = 4;
            break;
        }
        case 16: {
            yoff = 0;
            head_yoff = 0;
            farm_frame = 0;
            barm_frame = 0;
            bleg_xoff = 2;
            break;
        }
        case 17: {
            yoff = 0;
            head_yoff = 1;
            farm_frame = 1;
            barm_frame = 1;
            bleg_xoff = 0;
            break;
        }
    }
    // bootleg switch statement removed and replaced with legit switch statement, restorable via old repos as Omegas haven't been touched.
    
    // Attack
    if (statetime == 43) {
        // Choose attack
        state = choose(3, 6, 7, 20, 20);
        if (laststate == 1) {
            state = choose(3, 7, 20, 20);
        }
        statetime = 0;
        
        // Don't stomp if oCharacter is very far
        if (state == 7 &amp;&amp; point_distance(x, y, oCharacter.x, y) &gt; 280) state = 3;
        
        if (oCharacter.y &gt; y &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; slash_dist &amp;&amp; (oCharacter.x &gt; x &amp;&amp; facing == 1 || oCharacter.x &lt; x &amp;&amp; facing == -1)) state = 10;
        
        
        if (target_mode == 1) {
            // Turn around, otherwise jump?
            if (facing == -1 &amp;&amp; x &lt; room_width / 2 || facing == 1 &amp;&amp; x &gt;= room_width / 2) {
                state = 2;
            } else state = 7;
        }
        
        if ((oCharacter.y &lt; (y-48)) &amp;&amp; (oCharacter.state == 27) &amp;&amp; (abs(oCharacter.x-x) &lt;= 144) &amp;&amp; (oCharacter.x &gt; 64) &amp;&amp; (oCharacter.x &lt; (room_width-64))) { // Spiderball target state
            if (abs(oCharacter.x-x) &lt;= 48) { // if player is directly above, YEET INTO THE AIR
                state = 7;
                statetime = 0;
            }
            else if (sign(oCharacter.x-x) == facing) { // zap them!
                state = 11;
                statetime = 0;
            }
            else { // unless they're behind us, then turn and ZAPPEROO!
                state = 2;
                statetime = 0;
            }
        }
        if (state == 6) {
            laststate = 1;
        }
        else laststate = 0;
    }
} 

// Turn around
if (state == 2) {
    if (statetime == 0) {
        body_frame = 0;
        body_target_angle = 0;
        head_target_angle = 0;
        yoff = 0;
        head_yoff = 0;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        head_follow = 0;
        sfx_play(sndMOmegaBreathe);
    }
    if (statetime &gt; 0) {
        if (head_frame &lt; 2.5) head_frame += 0.25;
    }
    if (statetime == 10) {
        body_spr = sMOmega_Body_Turn;
        fleg_spr = -4;
        bleg_spr = -4;
        farm_spr = -4;
        barm_spr = -4;
        head_xoff = -20;
    }
    if (statetime == 14) facing *= -1;
    if (statetime &gt;= 18) {
        body_spr = omega_body;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        fleg_spr = sMOmega_FLeg;
        bleg_spr = sMOmega_BLeg;
        head_xoff = 0;
        if (head_frame &gt; 0) head_frame -= 0.25;
    }
    if (statetime == 22) {
        if (random(1) &lt; 0.5) {
            state = 1;
            statetime = -1;
        } else {
            state = 20;
            statetime = 0;
        }
        
        // Slash attack
        if (oCharacter.y &gt; y &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; slash_dist &amp;&amp; (oCharacter.x &gt; x &amp;&amp; facing == 1 || oCharacter.x &lt; x &amp;&amp; facing == -1)) {
            state = 10;
            statetime = 0;
        }
        else if (oCharacter.y &lt; y-48 &amp;&amp; oCharacter.state == 27 &amp;&amp; abs(oCharacter.x-x) &lt;= 144) { // Spiderball target state
            if (abs(oCharacter.x-x) &lt;= 48) { // if player is directly above, walk
                state = 7;
                statetime = -1;
            }
            else { // zap them!
                state = 11;
                statetime = -1;
            }
        }
    }
} // Crouch before horizontal jump.
if (state == 3) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -35;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 1;
        xVel = 0;
        yVel = 0;
        sfx_play(sndMOmegaAttack);
        roaring = 60;
    }
    fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.5);
    bleg_frame = fleg_frame;
    farm_frame = anim_frame(farm_spr, farm_frame, 0.5);
    barm_frame = farm_frame;
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (floor(fleg_frame) == 4) yoff = 8;
    if (floor(fleg_frame) == 5) yoff = 10;
    if (floor(fleg_frame) == 6) yoff = 12;
    if (floor(fleg_frame) == 7) yoff = 14;
    if (floor(fleg_frame) == 8) yoff = 16;
    if (floor(fleg_frame) == 9) yoff = 18;
    if (statetime == 40) {
        state = 4;
        statetime = 0;
    }
} // Horizontal jump.
if (state == 4) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -30;
        fleg_spr = sMOmega_FLeg_Jump;
        bleg_spr = sMOmega_BLeg_Jump;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 1;
        yVel = -2;
        xVel = 6 * facing;
        sfx_play(sndMZetaJump);
        grab_obj = instance_create(x, y, oMOmegaGrab);
    }
    fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.5);
    bleg_frame = fleg_frame;
    if (isCollisionBottom(1) &gt; 0 &amp;&amp; statetime &gt; 10) {
        state = 5;
        statetime = 0;
        with (grab_obj) instance_destroy();
    }
    if (xVel &gt; 0 &amp;&amp; isCollisionRight(80) || xVel &lt; 0 &amp;&amp; isCollisionLeft(80)) xVel = 0;
    //if (oCharacter.state == 52) { } no purpose in leaving this here. Why, YAL?
} 

// Landing
if (state == 5) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -35;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 9;
        fleg_frame = 9;
        farm_frame = 8;
        barm_frame = 8;
        yoff = 0;
        head_follow = 0;
        head_target_angle = -30 * facing;
        yVel = 0;
        sfx_play(sndMZetaLand);
        make_smoke_explosion(x, y + 41);
        make_smoke_explosion(x + 10, y + 41);
        make_smoke_explosion(x - 10, y + 41);
        screen_shake(8, 3);
        eyes_close = 15;
    }
    xVel *= 0.6;
    if (statetime &lt; 10) body_frame = anim_frame(body_spr, body_frame, 0.5);
    if (statetime == 30 &amp;&amp; oCharacter.state == 40 &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; 150 &amp;&amp; (facing == 1 &amp;&amp; oCharacter.x &gt; x || facing == -1 &amp;&amp; oCharacter.x &lt; x)) {
        alarm[0] = 1;
        head_target_angle = 40 * facing;
        sfx_play(sndMOmegaFlame);
        roaring = 30;
    }
    if (statetime &gt;= 30) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, -0.5);
        bleg_frame = fleg_frame;
        farm_frame = anim_frame(farm_spr, farm_frame, -0.25);
        barm_frame = farm_frame;
    }
    if (statetime == 40) body_target_angle = 0;
    if (statetime &gt; 55) body_frame = anim_frame(body_spr, body_frame, -0.2);
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (floor(fleg_frame) == 4) yoff = 8;
    if (floor(fleg_frame) == 5) yoff = 10;
    if (floor(fleg_frame) == 6) yoff = 12;
    if (floor(fleg_frame) == 7) yoff = 14;
    if (floor(fleg_frame) == 8) yoff = 16;
    if (floor(fleg_frame) == 9) yoff = 18;
    if (floor(body_frame) == 0) oMOmegaMask.image_index = 0;
    if (floor(body_frame) &gt; 0) oMOmegaMask.image_index = 1;
    if (statetime == 70) {
        event_user(3);
        state = 1;
        statetime = -1;
        if (oCharacter.y &gt; y &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; slash_dist &amp;&amp; (oCharacter.x &gt; x &amp;&amp; facing == 1 || oCharacter.x &lt; x &amp;&amp; facing == -1)) {
            state = 10;
            statetime = 0;
        }
    }
} 

// Begin flame
if (state == 6) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -35;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 0;
        head_target_angle = -30 * facing;
        xVel = 0;
        yVel = 0;
        alarm[0] = 110;
        sfx_play(sndMOmegaBreathe);
    }
    if (statetime &lt; 110) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.25);
        bleg_frame = fleg_frame;
    }
    if (statetime == 110) {
        roaring = 60;
        head_target_angle = 40 * facing;
        body_target_angle = 30;
        sfx_play(sndMOmegaFlame);
    }
    if (statetime &gt;= 110) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, -0.25);
        bleg_frame = fleg_frame;
    }
    if (statetime == 130) head_target_angle = -30 * facing;
    if (statetime == 210) {
        event_user(3);
        state = 1;
        statetime = -1;
    }
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (floor(fleg_frame) == 4) yoff = 8;
    if (floor(fleg_frame) == 5) yoff = 10;
    if (floor(fleg_frame) == 6) yoff = 12;
    if (floor(fleg_frame) == 7) yoff = 14;
    if (floor(fleg_frame) == 8) yoff = 16;
    if (floor(fleg_frame) == 9) yoff = 18;
} 

// Vertical jump crouch
if (state == 7) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -35;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 1;
        xVel = 0;
        yVel = 0;
    }
    fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.5);
    bleg_frame = fleg_frame;
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (floor(fleg_frame) == 4) yoff = 8;
    if (floor(fleg_frame) == 5) yoff = 10;
    if (floor(fleg_frame) == 6) yoff = 12;
    if (floor(fleg_frame) == 7) yoff = 14;
    if (floor(fleg_frame) == 8) yoff = 16;
    if (floor(fleg_frame) == 9) yoff = 18;
    if (statetime == 30) {
        state = 8;
        statetime = 0;
    }
}

// Vertical jump
if (state == 8) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = 30;
        fleg_spr = sMOmega_FLeg_Jump;
        bleg_spr = sMOmega_BLeg_Jump;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 1;
        yVel = -4.6;
        xVel = 1 * facing;
        sfx_play(sndMZetaJump);
        if (target_mode == 1) xVel = 5 * facing;
    }
    fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.5);
    bleg_frame = fleg_frame;
    if (statetime &gt; 20) body_target_angle -= 2;
    if (statetime &gt; 20) yVel += 0.5;
    if (isCollisionBottom(1) &gt; 0 &amp;&amp; statetime &gt; 10) {
        state = 5;
        statetime = -1;
        screen_shake(30, 5);
        instance_create(x, y + 41, oMOmegaGroundHit);
    }
}

// Slash attack!
if (state == 10) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -5;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm_Slash;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 1;
        xVel = 0;
        yVel = 0;
        sfx_play(sndMOmegaBreathe);
    }
    if (statetime &lt; 20) {
        if (fleg_frame &lt; 3) fleg_frame += 0.25;
        if (farm_frame &lt; 2) farm_frame += 0.25;
        if (farm_xoff &lt; 10) farm_xoff += 0.5;
    }
    if (statetime == 20) {
        farm_frame = 3;
        farm_xoff = 0;
        proj = instance_create(x - surf_x + farm_x + 14 * facing, y - surf_y + farm_y + 38, oMOmega_Projectile);
        proj.hspeed = 3.5 * facing;
        proj.image_xscale = facing;
        sfx_play(sndArachnusSwipe);
    }
    if (statetime &gt; 20) {
        farm_frame = anim_frame(farm_spr, farm_frame, 0.5);
        if (fleg_frame &gt; 0) fleg_frame -= 0.25;
    }
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (statetime == 30) {
        if (random(1) &lt; 0.5) {
            state = 1;
        } else state = 6;
        statetime = -1;
    }
}

// Spiderball target
if (state == 11) {
    if (statetime == 0) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = -25;
        fleg_spr = sMOmega_FLeg;
        bleg_spr = sMOmega_BLeg;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 0;
        head_target_angle = -30 * facing;
        eyes_close = 15;
        //head_follow = 1;
        xVel = 0;
        yVel = 0;
        alarm[0] = 70;
        sfx_play(sndMOmegaBreathe);
    }
    /*if (statetime &lt; 110) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, 0.25);
        bleg_frame = fleg_frame;
    }*/
    if (statetime == 60) {
        head_target_angle = 60 * facing;
        body_target_angle = 40;
        sfx_play(sndMOmegaFlame);
        roaring = 30;
    }
    /*if (statetime &gt;= 110) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, -0.25);
        bleg_frame = fleg_frame;
    }*/
    //if (statetime == 80) head_target_angle = -30 * facing;
    if (statetime == 90) {
        event_user(3);
        state = 1;
        statetime = -1;
    }
    if (floor(fleg_frame) == 0) yoff = 0;
    if (floor(fleg_frame) == 1) yoff = 2;
    if (floor(fleg_frame) == 2) yoff = 4;
    if (floor(fleg_frame) == 3) yoff = 6;
    if (floor(fleg_frame) == 4) yoff = 8;
    if (floor(fleg_frame) == 5) yoff = 10;
    if (floor(fleg_frame) == 6) yoff = 12;
    if (floor(fleg_frame) == 7) yoff = 14;
    if (floor(fleg_frame) == 8) yoff = 16;
    if (floor(fleg_frame) == 9) yoff = 18;
} 

// Idle?
if (state == 20) {
    body_frame = 0;
    head_frame = 0;
    fleg_spr = sMOmega_FLeg;
    bleg_spr = sMOmega_BLeg;
    farm_spr = sMOmega_FArm;
    barm_spr = sMOmega_BArm;
    head_spr = omega_head;
    bleg_frame = 0;
    fleg_frame = 0;
    farm_frame = 0;
    barm_frame = 0;
    yoff = 0;
    head_follow = 1;
    
    // Slash if player is close
    if (statetime &lt; 30) {
        if (oCharacter.y &gt; y &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; slash_dist &amp;&amp; (oCharacter.x &gt; x &amp;&amp; facing == 1 || oCharacter.x &lt; x &amp;&amp; facing == -1)) {
            state = 10;
            statetime = -1;
        }
    }
    if (statetime == 30) {
        if (oCharacter.y &lt; y) {
            if (oCharacter.y &gt; y &amp;&amp; point_distance(x, y, oCharacter.x, y) &lt; 64) {
                state = 6;
            } else state = 7;
            statetime = -1;
        } else {
            state = 3;
            statetime = -1;
        }
    }
    
    // If player is too far, swap from vertical jump to horizontal
    if (state == 7 &amp;&amp; point_distance(x, y, oCharacter.x, y) &gt; 280) state = 3;
} 

// Zeta --&gt; Omega transition
if (state == 50) {
    if (statetime == 0) {
        tl = instance_create(x - facing * 6, y + 26, oMOmegaTailMutate);
        tl.image_xscale = facing;
        body_spr = sMOmega_BodyMutate;
        fleg_spr = sMOmega_FLegMutate;
        bleg_spr = sMOmega_BLegMutate;
        farm_spr = sMOmega_FArmMutate;
        barm_spr = sMOmega_BArmMutate;
        head_spr = sMOmega_HeadMutate;
        body_frame = 7;
        head_frame = 7;
        bleg_frame = 3;
        fleg_frame = 3;
        farm_frame = 3;
        barm_frame = 3;
        head_follow = 0;
        head_target_angle = 0;
        yoff = 18;
        tail.visible = false;
    }
    if (statetime == 30) head_shake = 4;
    if (statetime == 40) farm_shake = 4;
    if (statetime == 50) body_shake = 4;
    if (statetime == 60) {
        bleg_shake = 80;
        fleg_shake = 60;
        sfx_play(sndMGammaMorph);
    }
    if (statetime &gt; 60 &amp;&amp; statetime &lt; 100) {
        if (bleg_frame &gt; 0) bleg_frame -= 0.1;
        if (fleg_frame &gt; 0) fleg_frame -= 0.1;
    }
    if (statetime == 100) {
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        fleg_frame = 9;
        bleg_frame = 9;
    }
    if (statetime == 70) {
        body_shake = 80;
        head_shake = 80;
        sfx_play(sndMGammaEyes);
    }
    if (statetime &gt; 70 &amp;&amp; statetime &lt; 150) {
        if (body_frame &gt; 0) body_frame -= 0.1;
    }
    if (statetime == 150) {
        body_spr = omega_body;
        body_frame = 0;
    }
    if (statetime == 90) {
        farm_shake = 60;
        barm_shake = 80;
        fleg_shake = 10;
    }
    if (statetime &gt; 90 &amp;&amp; statetime &lt; 130) {
        if (farm_frame &gt; 0) farm_frame -= 0.1;
        if (barm_frame &gt; 0) barm_frame -= 0.1;
    }
    if (statetime == 130) {
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        farm_frame = 0;
        barm_frame = 0;
    }
    if (statetime == 110) {
        head_shake = 60;
        bleg_shake = 8;
        body_shake = 10;
    }
    if (statetime &gt; 110 &amp;&amp; statetime &lt; 190) {
        if (head_frame &gt; 0) head_frame -= 0.1;
    }
    if (statetime == 190) {
        head_spr = omega_head;
        head_frame = 0;
        head_xoff = 0;
        head_yoff = 0;
    }
    if (statetime &lt; 190) eyes_close = 2;
    if (statetime == 60) {
        bld = instance_create(x - 2 * facing, y + 15, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
        bld.image_yscale = -1;
    }
    if (statetime == 70) {
        bld = instance_create(x + 6 * facing, y + 10, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = -facing;
        bld.image_yscale = -1;
    }
    if (statetime == 90) {
        bld = instance_create(x + 14 * facing, y - 8, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
        bld.image_yscale = 1;
        bld = instance_create(x + 40 * facing, y, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = -facing;
        bld.image_yscale = -1;
    }
    if (statetime == 95) {
        bld = instance_create(x + 25 * facing, y - 2, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
        bld.image_yscale = -1;
    }
    if (statetime == 100) {
        bld = instance_create(x + 34 * facing, y - 15, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = -facing;
        bld.image_yscale = -1;
    }
    if (statetime == 110) {
        bld = instance_create(x + 40 * facing, y - 30, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
    }
    if (statetime == 120) {
        bld = instance_create(x + 42 * facing, y - 26, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = -facing;
        bld = instance_create(x + 20 * facing, y - 10, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
        bld.image_yscale = -1;
    }
    if (statetime == 135) {
        bld = instance_create(x + 40 * facing, y - 37, oFXAnimSpark);
        bld.sprite_index = sMGammaBlood1;
        bld.image_speed = 0.5;
        bld.image_alpha = 0.6;
        bld.image_xscale = facing;
        bld.image_yscale = -1;
    }
    if (statetime == 220) {
        body_frame = 0;
        head_frame = 0;
        body_target_angle = 0;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        farm_spr = sMOmega_FArm_Slash;
        barm_spr = sMOmega_BArm;
        head_spr = omega_head;
        bleg_frame = 9;
        fleg_frame = 9;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_follow = 0;
        head_target_angle = 0;
        yVel = 0;
        tail.visible = true;
        with (oMOmegaTailMutate) instance_destroy();
    }
    if (statetime &gt;= 220) {
        fleg_frame = anim_frame(fleg_spr, fleg_frame, -0.25);
        bleg_frame = fleg_frame;
        if (statetime &lt; 260) {
            if (farm_frame &lt; 2) farm_frame += 0.2;
            if (farm_xoff &lt; 10) farm_xoff += 0.5;
        }
    }
    if (statetime == 260) {
        farm_frame = 3;
        farm_xoff = 0;
        proj = instance_create(x - surf_x + farm_x + 14 * facing, y - surf_y + farm_y + 38, oMOmega_Projectile);
        proj.hspeed = 5 * facing;
        proj.image_xscale = facing;
        sfx_play(sndArachnusSwipe);
    }
    if (statetime &gt; 260) {
        farm_frame = anim_frame(farm_spr, farm_frame, 0.5);
        if (fleg_frame &gt; 0) fleg_frame -= 0.25;
    }
    if (statetime &lt; 110) {
        if (floor(fleg_frame) == 0) yoff = 22;
        if (floor(fleg_frame) == 1) yoff = 20;
        if (floor(fleg_frame) == 2) yoff = 18;
        if (floor(fleg_frame) == 3) yoff = 15;
    }
    if (statetime &lt; 150) {
        if (floor(body_frame) == 0) {
            head_xoff = -1;
            head_yoff = 1;
        }
        if (floor(body_frame) == 1) {
            head_xoff = -2;
            head_yoff = 2;
        }
        if (floor(body_frame) == 2) {
            head_xoff = -3;
            head_yoff = 3;
        }
        if (floor(body_frame) == 3) {
            head_xoff = -6;
            head_yoff = 5;
        }
        if (floor(body_frame) == 4) {
            head_xoff = -8;
            head_yoff = 7;
        }
        if (floor(body_frame) == 5) {
            head_xoff = -10;
            head_yoff = 8;
        }
        if (floor(body_frame) == 6) {
            head_xoff = -11;
            head_yoff = 9;
        }
        if (floor(body_frame) == 7) {
            head_xoff = -12;
            head_yoff = 10;
        }
    } // if (statetime &lt; 150)
    if (statetime &gt;= 220) {
        if (floor(fleg_frame) == 0) yoff = 0;
        if (floor(fleg_frame) == 1) yoff = 2;
        if (floor(fleg_frame) == 2) yoff = 4;
        if (floor(fleg_frame) == 3) yoff = 6;
        if (floor(fleg_frame) == 4) yoff = 8;
        if (floor(fleg_frame) == 5) yoff = 10;
        if (floor(fleg_frame) == 6) yoff = 12;
        if (floor(fleg_frame) == 7) yoff = 14;
        if (floor(fleg_frame) == 8) yoff = 16;
        if (floor(fleg_frame) == 9) yoff = 18;
    }
    if (statetime &gt; 290) {
        event_user(1);
        with (oEventCamera2) alarm[0] = 30;
        with (oGFTrooperYellow) alarm[0] = 45;
    }
} 

// Death state
if (state == 100) {
    xVel = 0;
    if (statetime == 0) {
        body_frame = 0;
        body_target_angle = -35;
        body_spr = omega_body;
        farm_spr = sMOmega_FArm;
        barm_spr = sMOmega_BArm;
        fleg_spr = sMOmega_FLeg_Crouch;
        bleg_spr = sMOmega_BLeg_Crouch;
        bleg_frame = 0;
        fleg_frame = 0;
        farm_frame = 0;
        barm_frame = 0;
        yoff = 0;
        head_yoff = 0;
        head_follow = 0;
        head_target_angle = -40 * facing;
        head_xoff = 0;
        xVel = 0;
        yVel = 0;
        sfx_play(sndMOmegaDeath);
        roaring = 160;
        eyes_close = 5000;
        if (instance_exists(grab_obj)) with (grab_obj) instance_destroy();
        with (cam) instance_destroy();
    } // if (statetime == 0)
    if (statetime &lt; 30) {
        fleg_frame = anim_frame(sMZeta_FLeg_Crouch, fleg_frame, 0.5);
        bleg_frame = fleg_frame;
    }
} // if (state == 100)
if (head_target_angle != head_angle) {
    head_angle = lerp(head_angle, head_target_angle, 0.1);
    head_angle = clamp(head_angle, head_angle_min, head_angle_max);
}
if (body_target_angle != body_angle_base) {
    body_angle_base += (body_target_angle - body_angle_base) / 10;
    body_angle_base = min(body_angle_base, body_angle_max);
    body_angle_base = max(body_angle_base, body_angle_min);
}
body_angle = body_angle_base * facing;
image_angle = body_angle;
body_x = surf_x + xoff * facing;
body_y = surf_y + yoff;
fleg_x = surf_x + fleg_xoff * facing;
fleg_y = surf_y + fleg_yoff;
bleg_x = surf_x + bleg_xoff * facing;
bleg_y = surf_y + bleg_yoff;
head_x = body_x + lengthdir_x(head_len * facing, body_angle + head_dir * facing) + head_xoff * facing;
head_y = body_y + lengthdir_y(head_len * facing, body_angle + head_dir * facing) + head_yoff;
mouth_x = head_x + lengthdir_x(mouth_len * facing, body_angle + head_dir * facing + mouth_dir * facing + head_angle);
mouth_y = head_y + lengthdir_y(mouth_len * facing, body_angle + head_dir * facing + mouth_dir * facing + head_angle);
farm_x = body_x + lengthdir_x(farm_len * facing, body_angle + farm_dir * facing) + farm_xoff * facing;
farm_y = body_y + lengthdir_y(farm_len * facing, body_angle + farm_dir * facing);
barm_x = body_x + lengthdir_x(barm_len * facing, body_angle + barm_dir * facing) + barm_xoff * facing;
barm_y = body_y + lengthdir_y(barm_len * facing, body_angle + barm_dir * facing);
if (head_follow) {
    head_target_angle = round(point_direction(x - surf_x + head_x, y - surf_y + head_y, targetx, targety));
    head_target_angle += 30 * facing;
    if (facing == 1) {
        if (head_target_angle &gt; 180) head_target_angle -= 360;
    } else head_target_angle -= 180;
}
statetime += 1;
if (flashing &gt; 0) flashing -= 1;
if (fxtimer &lt; 5) {
    fxtimer += 1;
} else fxtimer = 0;
/*if (roaring &gt; roarlast) {
    roarcount = 30;
}
if (roarcount &gt; 20) {
    roar_frame = 1;
} else if (roarcount &lt;= 20 &amp;&amp; roarcount &gt; 10) {
    roar_frame = 2;
} else if (roarcount &lt;= 10 &amp;&amp; roarcount &gt; 0) {
    roar_frame = 1;
} else {
    roar_frame = 0;
}*/
if (roaring &gt; 0) {
    roaring -= 1;
    if (roar_frame &lt; 2) {
        roar_frame += 0.25;
    }
} else if (roar_frame &gt; 0) {
    roar_frame -= 0.25;
}
//if (roarcount &gt; 0) roarcount -= 1;
if (bleg_shake &gt; 0) bleg_shake -= 1;
if (barm_shake &gt; 0) barm_shake -= 1;
if (body_shake &gt; 0) body_shake -= 1;
if (head_shake &gt; 0) head_shake -= 1;
if (farm_shake &gt; 0) farm_shake -= 1;
if (fleg_shake &gt; 0) fleg_shake -= 1;
if (eyes_close &gt; 0) eyes_close -= 1;
if (eyes_close == 0) {
    if (eyes_frame &gt; -1) eyes_frame -= 0.25;
} else if (eyes_frame &lt; 4) eyes_frame += 1;
if (target_mode == 1 &amp;&amp; distance_to_point(targetx, targety) &lt; 32) target_mode = 0;
moveTo(xVel, yVel);
</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>// Draw Omega surface

var bl_xoff, ba_xoff, bo_xoff, he_xoff, fa_xoff, fl_xoff, bl_yoff, ba_yoff, bo_yoff, he_yoff, fa_yoff, fl_yoff;
if (surface_exists(surf)) {
    surface_set_target(surf);
    draw_clear_alpha(c_blue, 0);
    bl_xoff = 0;
    ba_xoff = 0;
    bo_xoff = 0;
    he_xoff = 0;
    fa_xoff = 0;
    fl_xoff = 0;
    bl_yoff = 0;
    ba_yoff = 0;
    bo_yoff = 0;
    he_yoff = 0;
    fa_yoff = 0;
    fl_yoff = 0;
    if (bleg_shake &gt; 0) {
        bl_xoff = choose(-1, 0, 1);
        bl_yoff = choose(-1, 0, 1);
    }
    if (barm_shake &gt; 0) {
        ba_xoff = choose(-1, 0, 1);
        ba_yoff = choose(-1, 0, 1);
    }
    if (body_shake &gt; 0) {
        bo_xoff = choose(-1, 0, 1);
        bo_yoff = choose(-1, 0, 1);
    }
    if (head_shake &gt; 0) {
        he_xoff = choose(-1, 0, 1);
        he_yoff = choose(-1, 0, 1);
    }
    if (farm_shake &gt; 0) {
        fa_xoff = choose(-1, 0, 1);
        fa_yoff = choose(-1, 0, 1);
    }
    if (fleg_shake &gt; 0) {
        fl_xoff = choose(-1, 0, 1);
        fl_yoff = choose(-1, 0, 1);
    }
    if (bleg_spr != -4) draw_sprite_ext(bleg_spr, bleg_frame, body_x + bl_xoff, surf_y + bl_yoff, facing, 1, 0, -1, 1);
    if (barm_spr != -4) draw_sprite_ext(barm_spr, barm_frame, barm_x + ba_xoff, barm_y + ba_yoff, facing, 1, 0, -1, 1);
    if (body_spr != -4) draw_sprite_ext(body_spr, body_frame, body_x + bo_xoff, body_y + bo_yoff, facing, 1, body_angle, -1, 1);
    // SPECIAL
    //if (head_spr != -4) draw_sprite_ext(head_spr, head_frame, head_x + he_xoff, head_y + he_yoff, facing, 1, body_angle + head_angle, -1, 1);
    if ((head_spr != -4) &amp;&amp; ((roar_frame == 0) || (state == 2))) {
        draw_sprite_ext(head_spr, head_frame, head_x + he_xoff, head_y + he_yoff, facing, 1, body_angle + head_angle, -1, 1);
    } else if ((head_spr != -4) &amp;&amp; (roar_frame &gt; 0)) {
       draw_sprite_ext(omega_head_roar, roar_frame, head_x + he_xoff, head_y + he_yoff, facing, 1, body_angle + head_angle, -1, 1); 
    }
    // END SPECIAL
    if (farm_spr != -4) draw_sprite_ext(farm_spr, farm_frame, farm_x + fa_xoff, farm_y + fa_yoff, facing, 1, 0, -1, 1);
    if (fleg_spr != -4) draw_sprite_ext(fleg_spr, fleg_frame, body_x + fl_xoff, surf_y + fl_yoff, facing, 1, 0, -1, 1);
    if (eyes_frame &gt;= 0 &amp;&amp; head_spr == sMOmega_Head &amp;&amp; head_frame == 0) draw_sprite_ext(sMOmega_Eyes, eyes_frame, head_x + he_xoff, head_y + he_yoff, facing, 1, body_angle + head_angle, -1, 1);
    surface_reset_target();
} // if (surface_exists(surf))
</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>if (target_mode == 0 &amp;&amp; (x &lt; limit_left || x &gt; limit_right)) {
    targetx2 = room_width / 2;
    target_mode = 1;
}
if (target_mode == 0) {
    targetx = oCharacter.x;
    targety = oCharacter.y;
} else if (target_mode == 1) {
    targetx = targetx2;
    targety = y;
}
</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>with (mask_obj) instance_destroy();
with (mask2_obj) instance_destroy();
with (mask3_obj) instance_destroy();
with (mask4_obj) instance_destroy();
with (head_obj) instance_destroy();
</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>state = 1;
statetime = 0;
sfx_play(sndMOmegaIntro);
roaring = 90;
mus_omega_monster();
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);
cam = instance_create(x, y, oObjectCamera);
cam.target_obj = id;
</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>myhealth -= dmg;
flashing = flashtime;
canbehit = 0;
if (myhealth &lt;= 0) {
    state = 100;
    statetime = 0;
    alarm[10] = 1;
    alarm[11] = 160;
    event_user(2);
    mus_fadeout(musOmegaFight);
    oMusicV2.bossbgm = sndJump;
    global.metdead[myid] = 1;
    global.monstersleft -= 1;
    global.monstersarea -= 1;
    check_areaclear();
    global.dmap[mapposx, mapposy] = 11;
    with (oControl) event_user(2);
}
if (myhealth &gt; 0) {
    if (dmg &lt; 100) { // missile
        PlaySoundMono(sndMOmegaHit);
        roaring = 30;
    } else { // super missile
        PlaySoundMono(sndMOmegaHit2);
        roaring = 160;
    }
}
</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 &amp;&amp; state != 0) {
    mus_stop(musOmegaFight);
    with (oMusicV2) {
        alarm[4] = -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.OmegaPalette, 1, false);
}

if (surface_exists(surf)) {
    if (!flashing) {
        draw_surface_ext(surf, x - surf_x, y - surf_y, 1, 1, 0, image_blend, 1);
    } else {
        draw_surface_ext(surf, x - surf_x, y - surf_y, 1, 1, 0, make_color_rgb(255 - fxtimer * 63, 255 - fxtimer * 63, 255 - fxtimer * 63), 1);
        draw_set_blend_mode(bm_add);
        repeat (2) draw_surface_ext(surf, x - surf_x, y - surf_y, 1, 1, 0, -1, 1 - fxtimer * 0.25);
        draw_set_blend_mode(bm_normal);
    }
} else {
    surface_free(surf);
    surf = surface_create(200, 160);
    event_user(10);
}

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>
