Esempio n. 1
0
    def __init__(self, player):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player, self._BACKGROUND_IMAGE)

        self.player = player
        self.show_text(self._INTRO_TEXT)
        self.level_limit = -1000

        # Array with width, height, x, and y of platform
        level = [[210, 70, 500, 500],
                 [210, 70, 800, 400],
                 [210, 70, 1000, 500],
                 [210, 70, 1120, 280],
                 ]

        # Go through the array above and add platforms
        for platform in level:
            block = Platform()
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            block.player = self.player
            self.platform_list.add(block)

        self.enemy_list = pygame.sprite.Group()
        self.make_n_random_enemies(2)
Esempio n. 2
0
    def __init__(self, player, active_sprite_list):
        """ Create level 1. """

        # Call the parent constructor
        Level.__init__(self, player, self._BACKGROUND_IMAGE)
        self.show_text(self._INTRO_TEXT)
        self.active_sprite_list = active_sprite_list

        self.level_limit = -1000

        # Array with type of platform, and x, y location of the platform.
        level = [
            [210, 30, 450, 500],
            [210, 30, 850, 500],
            [210, 30, 1000, 500],
        ]

        # Go through the array above and add platforms
        for platform in level:
            block = Platform()
            block.rect.x = platform[2]
            block.rect.y = platform[3]
            block.player = self.player
            self.platform_list.add(block)

        toots = Toots(player, self.active_sprite_list)
        toots.level = self
        toots.rect.x = 1000
        toots.rect.y = SCREEN_HEIGHT + 100
        self.enemy_list = pygame.sprite.Group()
        self.enemy_list.add(toots)