You may need some simple state apparatus. When the key is unavailable (see sf :: Input IsKeyDown method ), enter the character in the "animated" state. When the key is not lowered, the character must be in a "not animated" state. Of course, you can always skip this “state” and just do what I mention below (depending on what you are doing).
, "" , "" ( . ). , , 4- , (currentIndex + 1) % ARRAY_SIZE. , , . "" , .
"4 " , sf:: Sprite SetSubRect, . 4 , , , sf:: Sprite SetImage .