title: Game Maker - Freezing an sprite on animation end
body: <p>When the player dies, I want the sprite to stop animating on the last frame.</p>
  
  <p>I tried this on Animation End event</p>
  
  <pre><code>if  (sprite_index == spr_ninja_dead) {
      image_speed = 0;
      image_index = image_number - 1;
  }
  </code></pre>
  
  <p>I also tried this</p>
  
  <pre><code>if  (sprite_index == spr_ninja_dead) {
      image_speed = 0;
      image_index = 9;
  }
  </code></pre>
  
  <p>This is the recommended way that GM suggests, yet the sprite freezes on the first sub image. What am I doing wrong?</p>