<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>s_down_kos</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>0</persistent>
  <parentName>o_bot_main</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>move = 0; //0-idle 1-move 2-turn
turn1 = 0;
turn2 = 0;
rot1 = 270;
rot2 = 270;
alarm[0] = 30; //down (turn1), alarm[0] up (turn2)
alarm[2] = choose(50, 60, 70, 80, 90); //for shooting
fire = 0;
</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>alarm[2] = choose(55, 60, 65, 70);
if rot2 == 0 or rot2 == 90 or rot2 == 180 or rot2 == 270
{
    if collision_line(x+lengthdir_x(40, rot2), y+lengthdir_y(40, rot2), x+lengthdir_x(512, rot2), y+lengthdir_y(512, rot2), o_player_main, 0, 1)
    {
        fire = 0;
        son = instance_create(x+lengthdir_x(32, rot2), y+lengthdir_y(32, rot2), o_bullet1);
        son.speed = 4;
        son.direction = rot2;
        exit;
    }
    fire++;
    if fire &gt; 5
    {
        fire = 0;
        son = instance_create(x+lengthdir_x(32, rot2), y+lengthdir_y(32, rot2), o_bullet1);
        son.speed = 4;
        son.direction = rot2;
        exit;
    }
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="1">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>///up, AI
turn2 = 0;
rot2 = (round(rot2/90))*90;
</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>///down, AI
zz = irandom(6);
if move == 0
{
    turn1 = 0;
    rot2 = rot1;
    move = 1;
    alarm[0] = 30;
}
if move == 1//if moving
{
    ss_grid();
    if zz == 0//stop
    {
        move = 0;
        alarm[0] = choose(30, 60, 90);
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1+90), y+lengthdir_y(40, rot1+90), o_busy, 0, 1)//wanna turn left
    {
        if zz == 1
        {
            move = 0;
            turn1 = -1;
            turn2 = -1;
            alarm[0] = 30;
            alarm[1] = 15;
            exit;
        };
    };
    if !collision_point(x+lengthdir_x(40, rot1-90), y+lengthdir_y(40, rot1-90), o_busy, 0, 1)//wanna turn right
    {
        if zz == 2
        {
            move = 0;
            turn1 = 1;
            turn2 = 1;
            alarm[0] = 30;
            alarm[1] = 15;
            exit;
        };
    };
    if !collision_point(x+lengthdir_x(40, rot1), y+lengthdir_y(40, rot1), o_busy, 0, 1)//wanna move forward
    {
        alarm[0] = 30;
        instance_create(x, y, o_busy_block);
        instance_create(x+lengthdir_x(40, rot1), y+lengthdir_y(40, rot1), o_busy_block);
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1+90), y+lengthdir_y(40, rot1+90), o_busy, 0, 1) and !collision_point(x+lengthdir_x(40, rot1-90), y+lengthdir_y(40, rot1-90), o_busy, 0, 1)
    {
        move = 0;//random turn if way forward blocked
        turn1 = choose(-1, 1);
        turn2 = turn1;
        alarm[0] = choose(30, 30, 30, 30, 30, 30, 30, 60);
        alarm[1] = alarm[0]/2;
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1+90), y+lengthdir_y(40, rot1+90), o_busy, 0, 1)
    {
        move = 0;//turn left if way forward blocked
        turn1 = -1;
        turn2 = turn1;
        alarm[0] = 30;
        alarm[1] = 15;
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1-90), y+lengthdir_y(40, rot1-90), o_busy, 0, 1)
    {
        move = 0;//turn right if way forward blocked
        turn1 = 1;
        turn2 = turn1;
        alarm[0] = 30;
        alarm[1] = 15;
        exit;
    };
        move = 0;//stucked, start to random turn
        turn1 = choose(-1, 1);
        turn2 = turn1;
        alarm[0] = choose(30, 30, 30, 30, 30, 30, 30, 60);
        alarm[1] = alarm[0]/2;
        exit;
};
</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>depth = point_distance(x, y, room_width/2, room_height/2);
if turn1 == -1 rot1 += 3;
if turn1 == 1 rot1 -= 3;
if turn2 == -1 rot2 += 6;
if turn2 == 1 rot2 -= 6;
if move == 1
{
    x += lengthdir_x(1.33, rot1);
    y += lengthdir_y(1.33, rot1);
}
</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>var xx = (x - (room_width/2))/1024;
var yy = (y - (room_height/2))/382;
for (i=0; i&lt;25; i+=1)
{
    if i &lt; 15 draw_sprite_ext(s_down_kos, i, x+(xx*i), y+(yy*i), 1, 1, rot1, make_colour_rgb(200, 130, 250), 1);
    if i &gt; 15 draw_sprite_ext(s_up_kos, i, x+(xx*i), y+(yy*i), 1, 1, rot2, make_colour_rgb(200, 130, 250), 1);
};
</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
