def __init__(self):

        # Call the parent's constructor
        pygame.sprite.Sprite.__init__(self)
        sealSprites = SpriteSheet("enemy.png")

        # Load all the right facing images into a list
        image = sealSprites.get_image(0, 0, 64, 50)
        self.walking_frames_r.append(image)
        image = sealSprites.get_image(67, 0, 65, 60)
        self.walking_frames_r.append(image)

        # Load all the right facing images, then flip them
        # to face left.
        image = sealSprites.get_image(0, 0, 64, 50)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = sealSprites.get_image(67, 0, 65, 60)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)

        # Set the image the player starts with
        self.image = self.walking_frames_r[0]

        # Set a referance to the image rect.

        super(Monster, self).__init__()
        self.rect = self.image.get_rect()
        self.moveDirection = "Right"
        self.attackDamage = 6
Exemplo n.º 2
0
 def __init__(self, screen):
     pygame.init()
     self.screen = screen
     background = SpriteSheet("arctic background.png")
     title = SpriteSheet("Title.png")
     helpButton = SpriteSheet("HelpButton.png")
     startButton = SpriteSheet("StartButton.png")
     self.background = background.get_image(0,0,800,600)
     self.titleImage = title.get_image(0,0,443,51)
     self.helpButton = helpButton.get_image(0,0,100,50)
     self.startButton = startButton.get_image(0,0,100,50)
     self.inMainMenu = True
    def __init__(self):
        super(Projectile, self).__init__()

        pygame.sprite.Sprite.__init__(self)
        snowball = SpriteSheet("SmallSnowball.png")

        self.image = snowball.get_image(0, 0, 11, 11)
        self.rect = self.image.get_rect()
    def __init__(self, enemy):
        pygame.sprite.Sprite.__init__(self)
        battleProjectile = SpriteSheet("icicleSprite.png")
        self.image = battleProjectile.get_image(0,0,76,40)

        super(EnemyProjectile,self).__init__()
        self.rect = self.image.get_rect()
        self.rect.x = enemy.rect.x
        self.rect.y = enemy.rect.y+enemy.rect.height/2-self.rect.height/2
        self.change_x = -15
    def __init__(self, width, height, platform):
        """ Platform constructor. Assumes constructed with user passing in
            an array of 5 numbers like what's defined at the top of this code.
            """
        pygame.sprite.Sprite.__init__(self)
        platformSprite = SpriteSheet("platform.png")

        super(Platform,self).__init__()

        self.platform = platform
        self.isShop = platform.isShop
        self.isHealing = platform.isHealing
        if platform.isShop:
            self.image = platformSprite.get_image(0, 70, 210, 70)
        elif platform.isHealing:
            self.image = platformSprite.get_image(0, 140, 210, 70)
        else:
            self.image = platformSprite.get_image(0, 0, 210, 70)

        self.rect = self.image.get_rect()
    def __init__(self, player):

        pygame.sprite.Sprite.__init__(self)
        battlePenguinSprites = SpriteSheet("battlePenguin.png")

        self.image = battlePenguinSprites.get_image(0, 0, 124, 135)

        super(BattlePlayer,self).__init__()
        self.rect = self.image.get_rect()
        self.rect.x = 100
        self.rect.y = 120
        self.weapon = player.weapon
    def __init__(self, enemy):

        pygame.sprite.Sprite.__init__(self)
        battleSealSprite = SpriteSheet("battleSeal.png")

        image = battleSealSprite.get_image(0, 0, 232, 123)
        self.image = pygame.transform.flip(image, True, False)

        super(BattleEnemy,self).__init__()

        self.rect = self.image.get_rect()
        self.rect.x = 800-100-self.rect.width
        self.rect.y = 130
    def __init__(self):

        """ Constructor function """

        # Call the parent's constructor
        pygame.sprite.Sprite.__init__(self)
        penguinSprites = SpriteSheet("penguinSprites.png")

        # Load all the right facing images into a list
        image = penguinSprites.get_image(64, 0, 66, 63)
        self.walking_frames_r.append(image)
        image = penguinSprites.get_image(61, 64, 67, 63)
        self.walking_frames_r.append(image)
        image = penguinSprites.get_image(0, 0, 63, 63)
        self.walking_frames_r.append(image)
        image = penguinSprites.get_image(61, 64, 67, 63)
        self.walking_frames_r.append(image)

        # Load all the right facing images, then flip them
        # to face left.
        image = penguinSprites.get_image(64, 0, 66, 63)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = penguinSprites.get_image(61, 64, 67, 63)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = penguinSprites.get_image(0, 0, 63, 63)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)
        image = penguinSprites.get_image(61, 64, 67, 63)
        image = pygame.transform.flip(image, True, False)
        self.walking_frames_l.append(image)

        # Set the image the player starts with
        self.image = self.walking_frames_r[0]

        # Set a referance to the image rect.
        self.rect = self.image.get_rect()
    def __init__(self, attack, player):
        pygame.sprite.Sprite.__init__(self)
        if attack == "Attack":
            path = player.weapon.name + ".png"
            battleProjectile = SpriteSheet(path)
            if player.weapon.name == "SmallSnowball":
                self.image = battleProjectile.get_image(0,0,11,11)
            elif player.weapon.name == "Snowball":
                self.image = battleProjectile.get_image(0,0,15,15)
            elif player.weapon.name == "BigSnowball":
                self.image = battleProjectile.get_image(0,0,20,20)

        elif attack == "Fireball":
            battleProjectile = SpriteSheet("FireballSprite.png")
            self.image = battleProjectile.get_image(0,0,52,32)

        elif attack == "Iceball":
            battleProjectile = SpriteSheet("IceballSprite.png")
            self.image = battleProjectile.get_image(0,0,52,32)

        elif attack == "Double Throw":
            if player.weapon.name == "SmallSnowball":
                battleProjectile = SpriteSheet("DoubleSmallSnowball.png")
                self.image = battleProjectile.get_image(0,0,25,11)
            elif player.weapon.name == "Snowball":
                battleProjectile = SpriteSheet("DoubleSnowball.png")
                self.image = battleProjectile.get_image(0,0,37,15)
            elif player.weapon.name == "BigSnowball":
                battleProjectile = SpriteSheet("DoubleBigSnowball.png")
                self.image = battleProjectile.get_image(0,0,50,20)
        elif attack == "Triple Throw":
            if player.weapon.name == "SmallSnowball":
                battleProjectile = SpriteSheet("SmallTripleThrow.png")
                self.image = battleProjectile.get_image(0,0,23,21)
            elif player.weapon.name == "Snowball":
                battleProjectile = SpriteSheet("TripleThrow.png")
                self.image = battleProjectile.get_image(0,0,31,29)
            if player.weapon.name == "BigSnowball":
                battleProjectile = SpriteSheet("BigTripleThrow.png")
                self.image = battleProjectile.get_image(0,0,42,39)

        super(BattleProjectile,self).__init__()
        self.rect = self.image.get_rect()
        self.rect.x = player.rect.x+player.rect.width
        self.rect.y = player.rect.y+player.rect.height/2-self.rect.height/2
        self.change_x = 15
Exemplo n.º 10
0
 def __init__(self,screen):
     pygame.font.init()
     helpScreen = SpriteSheet("HelpScreen.png")
     self.helpScreen = helpScreen.get_image(0,0,800,600)
     self.screen = screen
     self.inHelpScreen = True