def __init__(self, initial_pos, direction): try: if FireBall.images == None: FireBall.images = common.load_animation(self.FIREBALL_BASENAME, -1) except AttributeError: FireBall.images = common.load_animation(self.FIREBALL_BASENAME, -1) common.AnimatedSprite.__init__(self, FireBall.images, 10) self.rect.midleft = initial_pos self.direction = direction if self.direction == common.DIRECTION_LEFT: self.images = [pygame.transform.flip(image, True, False) for image in self.images] self.rect.midright = self.rect.midleft common.play_sfx('hadouken.wav') self.damage = 10
def __init__(self, initial_pos, direction): try: if Dragon.images == None: Dragon.images = common.load_animation('dragon', -1, pixel_location = (725, 0)) except AttributeError: Dragon.images = common.load_animation('dragon', -1, pixel_location = (725, 0)) common.AnimatedSprite.__init__(self, Dragon.images, 9) self.rect.top = 0 self.rect.center = initial_pos[0], self.rect.center[1] self.direction = direction if self.direction == common.DIRECTION_LEFT: self.images = [pygame.transform.flip(image, True, False) for image in self.images] self.rect.move_ip((50,0)) else: self.rect.move_ip((-50,0)) self.damage = 40 self.sfx = common.play_sfx('roar.wav')