<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>s_13</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>0</persistent>
  <parentName>o_bot_main</parentName>
  <maskName>s_block1_c</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;
turn1 = 0;
turn2 = 0;
rot1 = 180;
rot2 = 180;
fire = choose(0, 1, 2);
hp = 3;
max_hp = 3;
see = 1;
sloi = 0;
alarm[10] = 2;
alarm[3] = 60;
alarm[2] = choose(10, 30);
</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>if sloi &lt; 30
{
    sloi++;
    alarm[10] = 10;
    alarm[0] = 30;
    alarm[2] = 10 + choose(20, 40);
    fire = choose(1, 3, 3);
    hp = max_hp;
    see = 1;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="2" enumb="8">
      <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 hp &lt; max_hp
{
    hp++;
    alarm[8] = 120;
}
</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>///крутит башней к ближайшей цели
alarm[3] = 240;
if instance_exists(o_player_main)
{
    var look, targ;
    targ = instance_nearest(x, y, o_player_main);
    look = point_direction(x, y, targ.x, targ.y);
    look = (round(look/90))*90;
    if look = 0
    {
        if rot2 == 0
        {
            alarm[3] = 60;
            exit;
        };
        if rot2 == 90
        {
            turn2 = 1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 270
        {
            turn2 = -1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 180
        {
            turn2 = choose(-1, 1);
            alarm[1] = 180;
            alarm[3] = 210;
            exit;
        };
    };
    if look = 90
    {
        if rot2 == 90
        {
            alarm[3] = 60;
            exit;
        };
        if rot2 == 180
        {
            turn2 = 1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 0
        {
            turn2 = -1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 270
        {
            turn2 = choose(-1, 1);
            alarm[1] = 180;
            alarm[3] = 210;
            exit;
        };
    };
    if look = 180
    {
        if rot2 == 180
        {
            alarm[3] = 60;
            exit;
        };
        if rot2 == 270
        {
            turn2 = 1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 90
        {
            turn2 = -1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 0
        {
            turn2 = choose(-1, 1);
            alarm[1] = 180;
            alarm[3] = 210;
            exit;
        };
    };
    if look = 270
    {
        if rot2 == 270
        {
            alarm[3] = 60;
            exit;
        };
        if rot2 == 0
        {
            turn2 = 1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 180
        {
            turn2 = -1;
            alarm[1] = 90;
            alarm[3] = 120;
            exit;
        };
        if rot2 == 90
        {
            turn2 = choose(-1, 1);
            alarm[1] = 180;
            alarm[3] = 210;
            exit;
        };
    };
    exit;
};
</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>///shoot
alarm[2] = choose(55, 60, 65, 70);
fire++;
if rot2 == 0 or rot2 == 90 or rot2 == 180 or rot2 == 270
{
    if fire &gt; 4
    {
        fire = 0;
        audio_play_sound(w_rocket, 1, 0);
        audio_sound_pitch(w_rocket, choose(0.8, 0.9, 1, 1.1, 1.2));
        son = instance_create(x+lengthdir_x(32, rot2), y+lengthdir_y(32, rot2), o_rocket);
        son.speed = 3;
        son.direction = rot2;
        son.cc = c_fuchsia;
        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;
if rot2 &lt; 0 rot2 += 360;
if rot2 &gt;= 360 rot2 -= 360;
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 rot1 &lt; 0 rot1 += 360;
if rot1 &gt;= 360 rot1 -= 360;
if move == 0
{
    if sloi != 30 exit;
    turn1 = 0;
    move = 1;
    alarm[0] = 20;
};
if move == 1
{           //if moving
    ss_grid();
    i = 40;
    while !(collision_point(x+lengthdir_x(i, rot1), y+lengthdir_y(i, rot1), o_block3_a, 0, 1))
    {
        if collision_point(x+lengthdir_x(i, rot1), y+lengthdir_y(i, rot1), o_player_main, 0, 1)
        {   //player detected - stop
            move = 0;
            alarm[0] = choose(60, 90, 120);
            exit;
        };
        if collision_point(x+lengthdir_x(i, rot1), y+lengthdir_y(i, rot1), o_block2, 0, 1) break;
        i += 40;
    };
    i = 40;
    while !(collision_point(x+lengthdir_x(i, rot1+90), y+lengthdir_y(i, rot1+90), o_block3_a, 0, 1))
    {
        if collision_point(x+lengthdir_x(i, rot1+90), y+lengthdir_y(i, rot1+90), o_player_main, 0, 1)
        {   //player detected left
            move = 0;
            turn1 = -1;
            alarm[0] = 50;
            exit;
        };
        if collision_point(x+lengthdir_x(i, rot1+90), y+lengthdir_y(i, rot1+90), o_block2, 0, 1) break;
        i += 40;
    };
    i = 40;
    while !(collision_point(x+lengthdir_x(i, rot1-90), y+lengthdir_y(i, rot1-90), o_block3_a, 0, 1))
    {
        if collision_point(x+lengthdir_x(i, rot1-90), y+lengthdir_y(i, rot1-90), o_player_main, 0, 1)
        {   //player detected right
            move = 0;
            turn1 = 1;
            alarm[0] = 50;
            exit;
        };
    if collision_point(x+lengthdir_x(i, rot1-90), y+lengthdir_y(i, rot1-90), o_block2, 0, 1) break;
    i += 40;
    };
};

if move == 1
{
    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;
            alarm[0] = 50;
            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;
            alarm[0] = 50;
            exit;
        };
    };
    if !collision_point(x+lengthdir_x(40, rot1), y+lengthdir_y(40, rot1), o_busy, 0, 1)
    {   //wanna move forward
        alarm[0] = 20;
        var son;
        son = instance_create(x, y, o_busy_block);
        son.alarm[0] = 20;
        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)
    {   //random turn if way forward blocked
        move = 0;
        turn1 = choose(-1, 1);
        alarm[0] = choose(50, 50, 50, 50, 50, 50, 50, 100);
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1+90), y+lengthdir_y(40, rot1+90), o_busy, 0, 1)
    {   //turn left if way forward blocked
        move = 0;
        turn1 = -1;
        alarm[0] = 50;
        exit;
    };
    if !collision_point(x+lengthdir_x(40, rot1-90), y+lengthdir_y(40, rot1-90), o_busy, 0, 1)
    {   //turn right if way forward blocked
        move = 0;
        turn1 = 1;
        alarm[0] = 50;
        exit;
    };          //stucked, start to random turn
                move = 0;
                turn1 = choose(-1, 1);
                alarm[0] = choose(50, 100);
                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 += 1.8;
if turn1 == 1 rot1 -= 1.8;
if turn2 == -1 rot2 += 1;
if turn2 == 1 rot2 -= 1;
if move == 1
{
    x += lengthdir_x(2, rot1);
    y += lengthdir_y(2, rot1);
}
if hp &lt;= 0
{
    instance_destroy();
    var son;
    son = instance_create(x, y, o_boom);
    son.cc = c_purple;
    ss_shake(5);
    audio_play_sound(w_boom, 1, 0);
    audio_sound_pitch(w_boom, choose(0.9, 0.95, 1, 1.05, 1.1));
    exit;
}
if hp == max_hp
{
    if see == 0 exit;
    see -= 0.01;
    if see &lt; 0 see = 0;
    exit;
};
else
{
    if see == 1 exit;
    see += 0.02;
    if see &gt; 1 see = 1;
    exit;
};
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="8" enumb="64">
      <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 see != 0
{
draw_set_alpha(see);
    for (i=0; i&lt;max_hp; i+=1)
    {
        draw_circle_colour(x-10-(max_hp*4)+(i*8), y-30, 4, c_dkgray, c_dkgray, 0);
    };
    for (i=0; i&lt;hp; i+=1)
    {
        draw_circle_colour(x-10-(max_hp*4)+(i*8), y-30, 3, c_fuchsia, c_fuchsia, 0);
    };
    draw_set_alpha(1);
};
</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, yy;
xx = (x - (room_width/2))/1024;
yy = (y - (room_height/2))/382;
if sloi &gt; 3 draw_sprite_ext(s_down2, 4, x, y, 1, 1, rot1, c_black, 0.2);
if sloi &gt; 18 draw_sprite_ext(s_up3, 4, x, y, 1, 1, rot2, c_black, 0.2);
for (i=0; i&lt;sloi; i+=1)
{
    if i &lt; 15 draw_sprite_ext(s_down2, 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_up3, 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>
