<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>s_down1</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>turn = choose(0, 90, 180, 270);//корпус
head = turn;//башня
torn_to = turn;//куда нужно повернуться
alarm[0] = 60;
move = 0;//0-idle 1-move 2-turn
</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>///bot AI
ss_grid();
if move == 0
{
    move = 1;
    alarm[0] = 60;
    exit;
};
if move == 1//moving
{
    var zz = irandom(4);
    if turn == 0//right
    {
        switch (zz)
        {
            case 0: if !collision_point(x, y+40, o_busy, 0, 1)
                    {
                        turn_to = 270;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move0();
                    break;
            case 1: if !collision_point(x, y-40, o_busy, 0, 1)
                    {
                        turn_to = 90;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move0();
                    break;
            default: ss_move0(); break;
        };
        exit;
    };
    if turn == 90//up
    {
        switch (zz)
        {
            case 0: if !collision_point(x-40, y, o_busy, 0, 1)
                    {
                        turn_to = 180;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move90();
                    break;
            case 1: if !collision_point(x+40, y, o_busy, 0, 1)
                    {
                        turn_to = 0;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move90();
                    break;
            default: ss_move90(); break;
        };
        exit;
    };
    if turn == 180//left
    {
        switch (zz)
        {
            case 0: if !collision_point(x, y+40, o_busy, 0, 1)
                    {
                        turn_to = 270;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move180();
                    break;
            case 1: if !collision_point(x, y-40, o_busy, 0, 1)
                    {
                        turn_to = 90;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move180();
                    break;
            default: ss_move180(); break;
        };
        exit;
    };
    if turn == 270//down
    {
        switch (zz)
        {
            case 0: if !collision_point(x-40, y, o_busy, 0, 1)
                    {
                        turn_to = 180;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move270();
                    break;
            case 1: if !collision_point(x+40, y, o_busy, 0, 1)
                    {
                        turn_to = 0;
                        move = 2;
                        alarm[0] = 30;
                        break;
                    };
                    ss_move270();
                    break;
            default: ss_move270(); break;
        };
        exit;
    };
};
if move == 2
{
    if turn == turn_to
    {
        move = 1;
        alarm[0] = 20;
    };
};
</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>image_angle = turn;
if turn &lt; 0 turn += 360;
if turn &gt;= 360 turn -= 360;
if move == 1
{
    switch (turn)
    {
        case 0: x+=1; break;
        case 90: y-=1; break;
        case 180: x-=1; break;
        case 270: y+=1; break;
        default: break;
    }
    exit;
}
if move == 2
{
    switch (turn_to)
    {
        case 0: if turn &gt;=180 turn += 3;
                if turn &lt;180 turn -= 3;
                break;
        case 90: if turn &gt;= 270 or turn &lt; 90 turn += 3;
                if turn &lt; 270 and turn &gt; 90 turn -= 3;
                break;
        case 180: if turn &lt; 180 turn += 3;
                if turn &gt; 180 turn -= 3;
                break;
        case 270: if turn &gt;=90 and turn &lt; 270 turn += 3;
                if turn &lt; 90 or turn &gt; 270 turn -= 3;
                break;
        default: break;
    }
    exit;
}
</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;15; i+=1)
{
    draw_sprite_ext(s_down1, i, x+(xx*i), y+(yy*i), 1, 1, image_angle, 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>
