help guys I am trying to get an animated sprite for the character of my game that gets a rect of the sprite which changes if he goes right,left,up or down.
here is the code:
if (e.key.code == sf::Keyboard::W) {
character.setTextureRect(IntRect(-30,97,60,30));
character.move(0, -5);
}
the problem here is that when I press "w" the character changes position a bit to the right and doesn`t stay in the position where the previous frame of the animation was, the movement works correctly after it goes right. hulp plz.