<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>spriteGuyIdle</spriteName>
  <solid>-1</solid>
  <visible>-1</visible>
  <depth>30</depth>
  <persistent>-1</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>//Prepare the player sprites
image_speed=0;

//Set AI target variables
global.Player_x=x;
global.Player_y=y;

//Set up control vars for player object

go=true;                //For controlling when the player can use the player
spd=5;                  //Max movement speed
acc=0.5;                //Acceleration
dec=0.1;                //Deceleration
h_spd=0;                //Current horizontal speed
v_spd=0;                //Current vertical speed

osc_index = 0;
osc_increment = degtorad(8);
osc_amplitude = 0.5;   

currentColor = 0;

key = noone;
colorSwitch = false;

hiddenGuy = instance_create(self.x, self.y, GuyHidden);

image_speed = 1.2;
hiddenGuy.image_speed = 1.2;

soundTalk[0] = Talk01;
soundTalk[1] = Talk02;
soundTalk[2] = Talk03;
soundTalk[3] = Talk04;
soundTalk[4] = Talk05;
soundTalk[5] = Talk06;

soundTalkImpact[0] = TalkImpact01;
soundTalkImpact[1] = TalkImpact02;
soundTalkImpact[2] = TalkImpact03;

alarm[0] = 5*30;

animationStep = 0;

animatedKey = false;
animatedCollision = false;
animatedPop = false;
animatedDepop = false;


</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>alarm[0] = random_range(5*30, 15*30);

soundIndex = floor(random(array_length_1d(soundTalk)));
   
audio_play_sound(soundTalk[soundIndex], 10, false);
</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>///Player Movement
if go
{
    oldVSpd = v_spd;
    oldHSpd = h_spd;

    if(currentColor != global.BackgroundColor)
    {
        currentColor = global.BackgroundColor
        if(currentColor = global.Orange)
        {
            sprite_index = spriteGuyJustHead;
            hiddenGuy.sprite_index = spriteGuyJustHead;
            
            audio_play_sound(Avale, 10, false);
        }
        else
        {
            sprite_index = spriteGuyIdle;
            hiddenGuy.sprite_index = spriteGuyHiddenIdle;
            
            
            
            if(!place_free(x, y))
            {           
                room_restart();
            }
        }
    }
    
    //Check keys
    if (keyboard_check(global.Up) &amp;&amp; !keyboard_check(global.Down))
    {
        v_spd = max(-spd, v_spd - acc);
    }
    else if (keyboard_check(global.Down) &amp;&amp; !keyboard_check(global.Up))
    {
        v_spd = min(spd, v_spd + acc);
    }   
    else if (v_spd != 0)
    {
        if(v_spd &gt; 0)
        {
            v_spd = max(0, v_spd - dec);
        }
        else
        {
            v_spd = min(0, v_spd + dec);
        }
    }
    
    if (keyboard_check(global.Left) &amp;&amp; !keyboard_check(global.Right))
    {
        h_spd = max(-spd, h_spd - acc);
    }
    else if (keyboard_check(global.Right) &amp;&amp; !keyboard_check(global.Left))
    {
        h_spd = min(spd, h_spd + acc);
    }   
    else if (h_spd != 0)
    {
        if(h_spd &gt; 0)
        {
            h_spd = max(0, h_spd - dec);
        }
        else
        {
            h_spd = min(0, h_spd + dec);
        }
    }
    
    //Flip
    if(h_spd &gt; 0 )
    {
        image_xscale = 1;
        hiddenGuy.image_xscale = 1;
    }
    else if (h_spd &lt; 0)
    {
        image_xscale = -1;
        hiddenGuy.image_xscale = -1;
    }
 
    //Key interaction
    if(key = noone)
    {
        key = collision_rectangle( x-40, y-50, x+40, y+50, Key, true, true );
        
        if( key != noone )
        {
            audio_play_sound(SfxClick, 10,false);
        }
    }
    
    if(key != noone)
    {
        key.solid = false;
        
        key.x = x;
        key.y = y - sprite_height/2;
    }   
    
    //Collision
    CollisionWithGroup(self, 55, 70);
    
    //Oscillator
    if(v_spd = 0)
    {
        osc_index += osc_increment;
        osc_shift = osc_amplitude * sin(osc_index);
        y += osc_shift;
    }
    
    /*if(oldVSpd = 0 &amp;&amp; oldHSpd = 0 &amp;&amp; (oldVSpd != v_spd || oldHSpd != h_spd))
    {
        audio_play_sound(MoveStart, 10, false);
    }*/

}

hiddenGuy.x = x;
hiddenGuy.y = y;

//Update the global player position
global.Player_x=x;
global.Player_y=y;



</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" enumb="4">
      <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(room != 0)
{
    x = global.InitX;
    y = global.InitY;
                
    v_spd = 0;
    h_spd = 0;
    
    key = noone;
}


</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>
    <point>0,0</point>
    <point>41,41</point>
  </PhysicsShapePoints>
</object>
