Logo Search packages:      
Sourcecode: magicor version File versions  Download package

def magicor::sprites::AnimatedSprite::setAnimation (   self,
  name,
  bResetIndex = True 
) [inherited]

Use specified set of animation.
Raises KeyError if the animation set is not found.

Definition at line 228 of file __init__.py.

00228                                                   :
        """
        Use specified set of animation.
        Raises KeyError if the animation set is not found.
        """
        if not self._animations.has_key(name):
            raise KeyError("no animation named '%s' for sprite %s"
                           %(name, type(self)))
        self._animationName = name
        self._index = 0
        self._count = 0
        self.image = None
        self.flags = {}
        self._srcRect = pygame.Rect((0, 0, 0, 0))
        for frame in self._animations[name]:
            if isinstance(frame, ImageFrame):
                self.image = self.resources[frame.resource]
                self.rect.left = self.x
                self.rect.top = self.y
                self.rect.width = frame.width
                self.rect.height = frame.height
                if self.width is None:
                    self.width = frame.width
                if self.height is None:
                    self.height = frame.height
            elif self.image and isinstance(frame, AnimationFrame):
                self._frameIndex = frame.frame
                break
            
    def animate(self):


Generated by  Doxygen 1.6.0   Back to index