title: Confusing Sprite Will Not Change
body: <p>I am working on a game with Gamemaker: Studio and have come across a little annoying problem with the sprite of the player not changing. I would like feedback as soon as possible. The sprite of "player" that is not changing is spr_playerboom. The idea is that then when the player hits Z, the sprite will change.</p>
  
  <pre><code>image_speed = 0.2;
  
  var zpress = keyboard_check(ord('Z'));
  var rkey = keyboard_check(vk_right);
  var lkey = keyboard_check(vk_left);
  var jkey = keyboard_check(vk_space);
  
  if(zpress){
  sprite_index = spr_playerboom;
  }
  
  //Check for ground
  if(place_meeting(x, y+1, obj_floor)){
  vspd = 0;
  
  //Jumping
  if(jkey){
  vspd = -jspd;
  }
  } else {
  
  //Gravity
  if(vspd &lt; 10){
  vspd += grav;
  }
  
  }
  
  //Moving right
  if(rkey){
  hspd = spd;
  sprite_index = spr_playerwalkright;
  }
  
  //Moving left
  if(lkey){
  hspd = -spd;
  sprite_index = spr_playerwalkleft;
  }
  
  
  
  //Check for not moving
  if((!rkey &amp;&amp; !lkey) || (rkey &amp;&amp; lkey) || (!zpress)){
  hspd = 0;
  sprite_index = spr_playerstand;
  }
  
  
  //Horizontal Collision
  if(place_meeting(x+hspd, y, obj_floor)){
  while(!place_meeting(x+sign(hspd), y, obj_floor)){
      x+=sign(hspd);
  }
  hspd = 0;
  }
  
  //Moving Horizontally
  x += hspd;
  
  
  
  
   //Vertical Collision
   if(place_meeting(x, y+vspd, obj_floor)){
   while(!place_meeting(x, y+sign(vspd), obj_floor)){
   y+=sign(vspd);
   }
   vspd = 0;
   }
   //Moving Vertically
   y += vspd;
  </code></pre>