def remove(self, other): playing = False if isinstance(other, (animation.Animation, animation.StaticAnimation)): if self.isPlaying(other): playing = True del self.animations[other.name] GameObject.remove(self, other) # handle when there are no animations left if len(self.animations) == 0: self.curAnimation = None self.curImage = None self.curFrame = None self.default = None self._is_paused = True elif playing: self.setDefault(self.animations.keys()[0]) self.reset()