<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>sBlockSand</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>-101</depth>
  <persistent>0</persistent>
  <parentName>oSolid</parentName>
  <maskName>sSolid</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>event_inherited();
image_speed = 0;

tileid = -1;
tilesandcrn0 = -1;
tilesandcrn1 = -1;
tilesandcrn2 = -1;
tilesandcrn3 = -1;


//Sand Fix
pos = string(x)+","+string(y);
//tileid = string_copy(global.sandarray[x,y], 1, 2);

if(room!=rm_a3h04) event_user(1);
else alarm[2] = 1;

//In case of emergency, cause both event_user(1) and alarm[2] to activate if in rm_a3ho4. Also mess with oTestKeys W key event, and oBlockSand alarm 2.
</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>instance_activate_region(x - 32, y - 32, 64, 64, 1);
with (instance_position(x, y - 16, oBlockSand)) alarm[0] = 1;
with (instance_position(x + 16, y, oBlockSand)) alarm[0] = 1;
with (instance_position(x, y + 16, oBlockSand)) alarm[0] = 1;
with (instance_position(x - 16, y, oBlockSand)) alarm[0] = 1;
with (instance_position(x + 16, y - 16, oBlockSand)) alarm[0] = 1;
with (instance_position(x + 16, y + 16, oBlockSand)) alarm[0] = 1;
with (instance_position(x - 16, y + 16, oBlockSand)) alarm[0] = 1;
with (instance_position(x - 16, y - 16, oBlockSand)) alarm[0] = 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>// - Emergency code for regenerating sand tile maps

/*ds_map_add(global.sand_map,pos,image_index);
ds_map_add(global.sandcrn0_map,pos,tilesandcrn0);
ds_map_add(global.sandcrn1_map,pos,tilesandcrn1);
ds_map_add(global.sandcrn2_map,pos,tilesandcrn2);
ds_map_add(global.sandcrn3_map,pos,tilesandcrn3);
*/

// - Normal event code begins here

tileid = tile_add(tlSandBlocks, ds_map_find_value(global.sand_map, pos)*16, 0, 16, 16, x, y, -100);

if (ds_map_find_value(global.sandcrn0_map, pos)) tilesandcrn0 = tile_add(tlSandCorners, 0*16, 0, 16, 16, x, y, -101);
if (ds_map_find_value(global.sandcrn1_map, pos)) tilesandcrn1 = tile_add(tlSandCorners, 1*16, 0, 16, 16, x, y, -101);
if (ds_map_find_value(global.sandcrn2_map, pos)) tilesandcrn2 = tile_add(tlSandCorners, 2*16, 0, 16, 16, x, y, -101);
if (ds_map_find_value(global.sandcrn3_map, pos)) tilesandcrn3 = tile_add(tlSandCorners, 3*16, 0, 16, 16, x, y, -101);
</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>tileid = tile_add(tlSandBlocks, image_index*16, 0, 16, 16, x, y, -100);

if (sandcrn0) tilesandcrn0 = tile_add(tlSandCorners, 0*16, 0, 16, 16, x, y, -101);
if (sandcrn1) tilesandcrn1 = tile_add(tlSandCorners, 1*16, 0, 16, 16, x, y, -101);
if (sandcrn2) tilesandcrn2 = tile_add(tlSandCorners, 2*16, 0, 16, 16, x, y, -101);
if (sandcrn3) tilesandcrn3 = tile_add(tlSandCorners, 3*16, 0, 16, 16, x, y, -101);
</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>event_user(1);
</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>if (tile_exists(tileid)) {
    tile_delete(tileid);
    tileid = -1;
}

if (tile_exists(tilesandcrn0)) {
    tile_delete(tilesandcrn0);
    tilesandcrn0 = -1;
}

if (tile_exists(tilesandcrn1)) {
    tile_delete(tilesandcrn1);
    tilesandcrn1 = -1;
}

if (tile_exists(tilesandcrn2)) {
    tile_delete(tilesandcrn2);
    tilesandcrn2 = -1;
}

if (tile_exists(tilesandcrn3)) {
    tile_delete(tilesandcrn3);
    tilesandcrn3 = -1;
}

instance_activate_region(x - 32, y - 32, 64, 64, 1);
if (instance_position(x, y - 16, oBlockSand)) {
    sandu = 1;
} else sandu = 0;
if (instance_position(x + 16, y, oBlockSand)) {
    sandr = 1;
} else sandr = 0;
if (instance_position(x, y + 16, oBlockSand)) {
    sandd = 1;
} else sandd = 0;
if (instance_position(x - 16, y, oBlockSand)) {
    sandl = 1;
} else sandl = 0;
if (instance_position(x + 16, y - 16, oBlockSand)) {
    sandur = 1;
} else sandur = 0;
if (instance_position(x - 16, y - 16, oBlockSand)) {
    sandul = 1;
} else sandul = 0;
if (instance_position(x + 16, y + 16, oBlockSand)) {
    sanddr = 1;
} else sanddr = 0;
if (instance_position(x - 16, y + 16, oBlockSand)) {
    sanddl = 1;
} else sanddl = 0;
if (sandu &amp;&amp; sandr &amp;&amp; !sandur) {
    sandcrn2 = 1;
} else sandcrn2 = 0;
if (sandu &amp;&amp; sandl &amp;&amp; !sandul) {
    sandcrn3 = 1;
} else sandcrn3 = 0;
if (sandd &amp;&amp; sandr &amp;&amp; !sanddr) {
    sandcrn0 = 1;
} else sandcrn0 = 0;
if (sandd &amp;&amp; sandl &amp;&amp; !sanddl) {
    sandcrn1 = 1;
} else sandcrn1 = 0;
if (sandu &amp;&amp; sandr &amp;&amp; sandd &amp;&amp; sandl) image_index = 0;
if (!sandu &amp;&amp; sandr &amp;&amp; sandd &amp;&amp; sandl) image_index = 1;
if (sandu &amp;&amp; !sandr &amp;&amp; sandd &amp;&amp; sandl) image_index = 2;
if (sandu &amp;&amp; sandr &amp;&amp; !sandd &amp;&amp; sandl) image_index = 3;
if (sandu &amp;&amp; sandr &amp;&amp; sandd &amp;&amp; !sandl) image_index = 4;
if (!sandu &amp;&amp; !sandr &amp;&amp; sandd &amp;&amp; sandl) image_index = 5;
if (sandu &amp;&amp; !sandr &amp;&amp; !sandd &amp;&amp; sandl) image_index = 6;
if (sandu &amp;&amp; sandr &amp;&amp; !sandd &amp;&amp; !sandl) image_index = 7;
if (!sandu &amp;&amp; sandr &amp;&amp; sandd &amp;&amp; !sandl) image_index = 8;
if (!sandu &amp;&amp; sandr &amp;&amp; !sandd &amp;&amp; sandl) image_index = 9;
if (sandu &amp;&amp; !sandr &amp;&amp; sandd &amp;&amp; !sandl) image_index = 10;
if (!sandu &amp;&amp; sandr &amp;&amp; !sandd &amp;&amp; !sandl) image_index = 11;
if (!sandu &amp;&amp; !sandr &amp;&amp; sandd &amp;&amp; !sandl) image_index = 12;
if (!sandu &amp;&amp; !sandr &amp;&amp; !sandd &amp;&amp; sandl) image_index = 13;
if (sandu &amp;&amp; !sandr &amp;&amp; !sandd &amp;&amp; !sandl) image_index = 14;
if (!sandu &amp;&amp; !sandr &amp;&amp; !sandd &amp;&amp; !sandl) image_index = 15;

alarm[1] = 1;
</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>repeat (2) {
    smk = instance_create(x + 2 + random(10), y + 2 + random(10), oFXAnimSpark);
    smk.image_speed = 0.6 + random(0.7);
    smk.additive = 0;
    smk.sprite_index = sSmoke1;
    smk.image_alpha = 0.4;
    smk.direction = 250 + random(40);
    smk.speed = random(1);
    smk.depth = -101;
}

if (tile_exists(tileid)) {
    tile_delete(tileid);
    tileid = -1;
}
if (tile_exists(tilesandcrn0)) {
    tile_delete(tilesandcrn0);
    tilesandcrn0 = -1;
}

if (tile_exists(tilesandcrn1)) {
    tile_delete(tilesandcrn1);
    tilesandcrn1 = -1;
}

if (tile_exists(tilesandcrn2)) {
    tile_delete(tilesandcrn2);
    tilesandcrn2 = -1;
}

if (tile_exists(tilesandcrn3)) {
    tile_delete(tilesandcrn3);
    tilesandcrn3 = -1;
}

alarm[0] = 1;
sfx_stop(sndBlockDestroy);
sfx_play(sndBlockDestroy);
instance_destroy();
</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>
