<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>spr_char_legs_idle</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>-100</depth>
  <persistent>-1</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>spr_char_mask</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>hspd = 0;
vspd = 0;

max_sp = 2;
move_sp = 0.75;
jump_sp = 6;

fric = 0.25;
grav = 0.5;

state = STATE_MOVE;

anim[SPR_IDLE] = spr_char_legs_idle;
anim[SPR_WALK] = spr_char_legs_walk;
anim[SPR_JUMP] = spr_char_legs_jump;
anim[SPR_DEATH] = spr_char_death;

body_spr = 0;
body_index = 0;
body_y = 0;
anim_body[0] = spr_char1;
anim_body[1] = spr_char1_fire;
gun = 0;

cooldown = 0;
hit_timer = 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>/// Room start
if (state == STATE_START) state = STATE_MOVE;
</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>/// Death
if (global.char_extra_life &lt;= 0) {
  game_restart();
  exit;
}

sprite_index = spr_char_legs_idle;
state = STATE_START;
game_speed = 1;
obj_ctrl.speed_down = false;
audio_emitter_pitch(global.snd_emitter, game_speed);
audio_emitter_pitch(global.msc_emitter, game_speed);
audio_resume_sound(snd_music);

global.char_life = global.char_life_max;
global.slow_motion = global.slow_motion_max;
global.char_coins = global.char_start_coins;
global.char_damage = 4;
gun = 0;

room_restart();
</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>body_spr = 0;
</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>if (global.game_status != GAME_STATUS_PLAY) exit;

switch(state) {
  case STATE_MOVE:
    if (cooldown &gt; 0) {
      cooldown = max(cooldown-1, 0);
    }
    if (hit_timer &gt; 0) {
      hit_timer = max(hit_timer-1, 0);
    }
    
    sc_apply_friction(fric);
    
    var _pos_locked = keyboard_check(global.key[KEY_LOCK_POS]);
    
    if (keyboard_check(global.key[KEY_LEFT]) &amp;&amp; hspd &gt; -max_sp) {
      if (!_pos_locked) hspd -= move_sp;
      image_xscale = -1;
    }
    if (keyboard_check(global.key[KEY_RIGHT]) &amp;&amp; hspd &lt; max_sp) {
      if (!_pos_locked) hspd += move_sp;
      image_xscale = 1;
    }
    if (keyboard_check(global.key[KEY_UP])) {
      if (keyboard_check(global.key[KEY_LEFT]) || keyboard_check(global.key[KEY_RIGHT]))
        body_index = -1;
      else
        body_index = -2;
    }
    else if (keyboard_check(global.key[KEY_DOWN])) {
      if (keyboard_check(global.key[KEY_LEFT]) || keyboard_check(global.key[KEY_RIGHT]))
        body_index = 1;
      else
        body_index = 2;
    }
    else
      body_index = 0;
    
    if (place_meeting(x, y+1, obj_wall)) {
      if (hspd != 0) {
        sprite_index = anim[SPR_WALK];
        image_speed = (hspd/5*image_xscale);
        body_y = (image_index div 2 mod 2)-1;
      }
      else {
        sprite_index = anim[SPR_IDLE];
        image_speed = 0.1;
        body_y = floor(image_index) == 2;
      }
      if (keyboard_check_pressed(global.key[KEY_JUMP])) {
        image_index = 0;
        vspd = -jump_sp;
      }
    }
    else {
      if (keyboard_check_released(global.key[KEY_JUMP]) &amp;&amp; vspd &lt; 0) {
        vspd /= 1.5;
      }
      sprite_index = anim[SPR_JUMP];
      image_speed = 0.7;
      
      var _half_frame = (image_number-1)/2;
      body_y = -1;
      if (vspd &lt; 0)
        image_index = clamp(image_index, 0, _half_frame);
      else if (vspd &gt; 0)
        image_index = clamp(image_index, _half_frame, image_number-1);
      
      if (vspd &lt; 10)
        vspd += grav;
    }
    
    if (keyboard_check(global.key[KEY_FIRE]) &amp;&amp; cooldown == 0) {
      var _dir = point_direction(0, 0, other.image_xscale, 0)+(-other.body_index*45*other.image_xscale);
      
      switch(gun) {
        case 0:
          audio_play_sound_on(global.snd_emitter, snd_shoot, false, 5);
          with(instance_create(x+lengthdir_x(8, _dir), y+lengthdir_y(8, _dir)+body_y, obj_bullet)) {
            spd = 10;
            dir = _dir;
            damage = global.char_damage;
          }
          cooldown = 6;
        break;
        case 1:
          audio_play_sound_on(global.snd_emitter, snd_twin_shoot, false, 5);
          for(var i = 0; i &lt; 2; i++) {
            with(instance_create(x+lengthdir_x(8, _dir), y+lengthdir_y(8, _dir)+body_y, obj_twin_bullet)) {
              if (i == 0) a = -1;
              else if (i == 1) a = 1;
              acc_sp = a*6;
              spd = 10;
              dir = _dir;
              damage = global.char_damage;
            }
          }
          cooldown = 8;
        break;
        case 2:
          audio_play_sound_on(global.snd_emitter, snd_shoot, false, 5);
          with(instance_create(x+lengthdir_x(8, _dir), y+lengthdir_y(8, _dir)+body_y, obj_bullet)) {
            life = 10;
            spd = 12;
            dir = _dir+(irandom_range(-20, 20)*game_speed);
            damage = global.char_damage/2;
          }
          cooldown = 2;
        break;
        case 3:
          audio_play_sound_on(global.snd_emitter, snd_shoot, false, 5);
          for(var i = -1; i &lt; 2; i++) {
            with(instance_create(x+lengthdir_x(8, _dir), y+lengthdir_y(8, _dir)+body_y, obj_time_bullet)) {
              a = i;
              spd = 8;
              dir = _dir;
              damage = global.char_damage;
            }
          }
          cooldown = 8;
        break;
        case 4:
          audio_play_sound_on(global.snd_emitter, snd_laser_shoot, false, 5);
          with(instance_create(x+lengthdir_x(12, _dir), y+lengthdir_y(12, _dir)+body_y, obj_laser_bullet)) {
            spd = 8;
            var _dir_calc = irandom(2/game_speed)*choose(-1, 1);
            dir = _dir+_dir_calc;
            damage = global.char_damage / game_speed;
          }
          cooldown = 10;
        break;
      }
      
      part_particles_create(global.prt_system, x+lengthdir_x(14, _dir), y+lengthdir_y(14, _dir), global.prt[PART_SMOKE], 5);
      body_spr = 1;
      alarm[0] = 2;
    }
    
    var _bush = instance_place(x, y+1, obj_bouncy_bush);
    if (_bush != noone) {
      var _dir = point_direction(_bush.x, _bush.y+12, x, y);
      var _len = 8;
      hspd = lengthdir_x(_len, _dir);
      vspd = lengthdir_y(_len, _dir);
      if (!audio_is_playing(snd_bush_jump)) {
        audio_play_sound_on(global.snd_emitter, snd_bush_jump, false, 5);
      }
      _bush.image_speed = game_speed;
    }
    if (keyboard_check_pressed(global.key[KEY_TIME_SLOW]) &amp;&amp; global.slow_motion &gt; 0) {
      with (obj_ctrl) {
        speed_down = !speed_down;
        alarm[1] = 1;
      }
    }
    if (game_speed &lt; 0.5) {
      with(instance_create(x, y, obj_char_effect)) {
        sprite_index = other.sprite_index;
        image_index = other.image_index;
        image_xscale = other.image_xscale;
        body_spr = other.body_spr;
        body_index = other.body_index;
        body_y = other.body_y;
        anim_body[0] = other.anim_body[0];
        anim_body[1] = other.anim_body[1];
      }
    }
    
    sc_move_obj_normal(obj_wall);
  break;
  case STATE_DEATH:
    sprite_index = anim[SPR_DEATH];
    image_speed = 1;
    
    if (vspd &lt; 10)
      vspd += grav;
    
    x += hspd;
    y += vspd;
  break;
  case STATE_START:
    hspd = 0;
    vspd = 0;
    image_speed = 0;
    if (alarm[2] == -1) alarm[2] = 20;
  break;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="obj_fireball">
      <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 (hit_timer == 0 &amp;&amp; state != STATE_DEATH) {
  global.char_life -= 35;
  hspd = sign(x-other.x)*3;
  if (global.char_life &lt;= 0) {
    sc_char_death();
    vspd = -5;
    exit;
  }
  vspd = -2;
  audio_play_sound_on(global.snd_emitter, snd_hurt, false, 6);
  hit_timer = 20;
  with(other) instance_destroy();
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="obj_lava">
      <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 (state != STATE_DEATH) {
  hspd = 0;
  vspd = -2;
  sc_char_death();
  audio_play_sound_on(global.snd_emitter, snd_hurt, false, 7);
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="obj_plant">
      <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 (other.image_index &gt;= 4 &amp;&amp; !other.attacked &amp;&amp; hit_timer == 0 &amp;&amp; state != STATE_DEATH) {
  global.char_life -= other.damage;
  hspd = sign(x-other.x)*3;
  if (global.char_life &lt;= 0) {
    sc_char_death();
    vspd = -5;
    exit;
  }
  vspd = -2;
  audio_play_sound_on(global.snd_emitter, snd_hurt, false, 6);
  hit_timer = 20;
  other.attacked = true;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="4" ename="obj_enemy_par">
      <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 (hit_timer == 0 &amp;&amp; state != STATE_DEATH) {
  global.char_life -= other.damage;
  hspd = sign(x-other.x)*3;
  if (global.char_life &lt;= 0) {
    sc_char_death();
    vspd = -5;
    exit;
  }
  vspd = -2;
  audio_play_sound_on(global.snd_emitter, snd_hurt, false, 6);
  hit_timer = 20;
}
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" 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>x = xprevious;
</string>
          </argument>
        </arguments>
      </action>
    </event>
    <event eventtype="7" 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>if (state != STATE_DEATH) {
  hspd = 0;
  vspd = 0;
  sc_char_death();
  audio_play_sound_on(global.snd_emitter, snd_hurt, false, 7);
}
</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 = floor(x);
var _yy = floor(y);
var _alpha = 1;
if (hit_timer &gt; 0) {
  _alpha = current_time/200*game_speed mod 1.5;
}
draw_sprite_ext(sprite_index, image_index, _xx, _yy, image_xscale, 1, 0, $ffffff, _alpha);
if (state != STATE_DEATH) {
  draw_sprite_ext(anim_body[body_spr], body_index+2, _xx, _yy+body_y, image_xscale, 1, 0, $ffffff, _alpha);
}
</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>
