def __init__(self, dpTop): Pony.__init__(self) self.appleTimer = 1000 self.dpTop = dpTop # load applejack image if not Applejack.images: Applejack.images['idle'] = load_image('applejack.png', (PONY_SIZE, PONY_SIZE)) self.image = Applejack.images['idle'] self.rect = self.image.get_rect() self.timeTilFire = 1000 self.range = 500
def __init__(self, dpTop): Pony.__init__(self) self.dpTop = dpTop # load rainbowdash image if not Rainbowdash.images: Rainbowdash.images['idle'] = load_image('rainbowdash.png', (PONY_SIZE, PONY_SIZE)) self.image = Rainbowdash.images['idle'] self.rect = self.image.get_rect() self.timeTilFire = 1000 self.range = 500 self.attacking = False
def __init__(self, dpTop): Pony.__init__(self) if not Twilight.images: Twilight.images['idle'] = load_image('twilight.png', (PONY_SIZE, PONY_SIZE)) Twilight.images['attacking'] = load_image('twilightGlowing.png', (PONY_SIZE, PONY_SIZE)) self.dpTop = dpTop self.image = Twilight.images['idle'] self.rect = self.image.get_rect() self.timeTilFire = 1000 self.range = 500 self.attacking = False
def __init__(self, dpTop): Pony.__init__(self) if not Rarity.images: Rarity.images['idle'] = [load_image('rarityWalking-'+str(i)+'.png', (PONY_SIZE, PONY_SIZE)) for i in xrange(24)] Rarity.images['attacking'] = load_image('rarityFindingGems.png', (PONY_SIZE, PONY_SIZE)) self.images = Rarity.images['idle'] AnimatedSprite.__init__(self, Rarity.images['idle'], 10) self.dpTop = dpTop self.rect = self.image.get_rect() self.timeTilFire = 1000 self.attackTime = 500 self.attacking = False
def __init__(self, dpTop): Pony.__init__(self) self.dpTop = dpTop if not Derpy.frames: Derpy.frames = [load_image('derpyFlying-'+str(i)+'.png', (PONY_SIZE, PONY_SIZE)).convert_alpha() for i in xrange(7)] AnimatedSprite.__init__(self, Derpy.frames) self.rect = self.image.get_rect() MovingSprite.__init__(self, None, 200) self.range = 500 self.attacking = False self.cooldown = 4000
def __init__(self, dpTop): Pony.__init__(self) if not Pinkie.images: Pinkie.images['idle'] = pygame.transform.flip(load_image('pinkieCannonIdle.png', (PONY_SIZE, PONY_SIZE)), True, False) Pinkie.images['attacking'] = pygame.transform.flip(load_image('pinkieCannonFiring.png', (PONY_SIZE, PONY_SIZE)), True, False) if not Pinkie.sounds: Pinkie.sounds['attack'] = pygame.mixer.Sound(os.path.join('data', 'audio', 'partyCannon.wav')) self.dpTop = dpTop self.image = Pinkie.images['idle'] self.rect = self.image.get_rect() self.timeTilFire = 2000 self.attackTime = 500 self.range = 500 self.attacking = False
def update(self, dTime): Pony.update(self) if self.attacking: self.attackTime -= dTime if self.attackTime <= 0: # stand back up self.attackTime = 500 self.attacking = False else: AnimatedSprite.update(self, dTime) self.timeTilFire -= dTime if self.timeTilFire <= 0 and not self.ghost: #find a gem self.image = Rarity.images['attacking'] self.timeTilFire = 3000 self.attacking = True g = Gem(self.dpTop) g.place(self.rect.center) self.dpTop.sprites.add(g) self.dpTop.clickables.add(g)