- elapsedTime:
- The time passed since the previous update
- '''
- self._animationOffset += elapsedTime
-
- if self._animationOffset > self.duration :
- #New animation offset is computed first, before updating the pointer
- self._animationOffset -= self.duration
- #point to the next image (restarts from the beginning when it reaches the end)
- self._imagePointer = (self._imagePointer + 1) % len(self.images)
-
- if self.flashing:
- self.image = pygame.image.load(self.flashImagePath).convert_alpha()
- else :
- self.image = pygame.image.load(self.images[self._imagePointer]).convert_alpha()