IMPORTANT - the key must be pressed when the animation returns to the initial frame. As the speed of the sprite increases, the speed of the animation also increases and, therefore, the frequency of pressing the key can be accelerated..
HAVE FUN :)