so I have this spritesheet (4 sprites in a row and 3 in a coloumn) which I use to animate a character in a game I make. It animates just fine without a problem, like I want it to
the problem start to arise when I want to change the state from "dash" (running to the enemy) to "attack" (well, attack the enemy) it doesn't seem to play the attack sprite from the start (index 0)
I've used self._currentFrame = 3 on the set_state(self) function so that when the function changes it resets the frame to the third frame, which makes (self.currentFrame + 1) % 4 returns 0
but still, sometimes it doesn't do what I want, and start the animation at about index 2 or 3 (the end of animation). How do I make sure that my animation starts at index 0?
my updating code is as follows, if it helps
self.frameTime += dt
if self.fps is not -1:
while self.frameTime > 1.0 / self.fps:
self.frameTime -= 1.0 / self.fps
self.currentFrame = (self.currentFrame + 1) % 4
self.currentVFrame = (self.currentVFrame + 1) % 3