Exemplo n.º 1
0
    def __init__(self, screen_height, screen_width):
        super().__init__(screen_height, screen_width)
        self.background = pygame.image.load(
            'Images/bg.jpg')  # where to get the background from
        self.platforms.empty()
        self.enemys.empty()
        self.dino_gun = False  # should he have a gun
        self.level_limit = -700  #changes per level
        level_platforms = [
            [
                pygame.Rect(-5, 0, 5, screen_height),
                (0, 0, 0),
                0,
                -0.12  # left safety wall
            ],
            [
                pygame.Rect(0, screen_height - 35,
                            screen_width - self.level_limit, 35),
                (0, 0, 0),
                0,
                -0.12  #ground
            ]
        ]  #populate with platforms

        for platform in level_platforms:
            self.platforms.add(Platform.from_list(platform))

        self.enemys.add(
            slime(700, 445, vec(3, 0),
                  pygame.Rect(600, 400, 200, 40)))  #customise and add more
Exemplo n.º 2
0
    def __init__(self, screen_height, screen_width):
        super().__init__(screen_height, screen_width)
        self.background = pygame.image.load('Images/bg.jpg')
        self.platforms.empty()
        self.enemys.empty()
        self.level_limit = -700
        self.dino_gun = True
        half_screen_width = self.screen_width // 2
        level_platforms = [
            [
                pygame.Rect(0, self.screen_height - 40,
                            half_screen_width - 200, 40), (0, 0, 0), 0, -0.099
            ],  # 1st ground
            [
                pygame.Rect(0, self.screen_height - 300,
                            (self.screen_width // 2) - 200, 40), (0, 0, 0), 0,
                -0.099
            ],  # special area
            [
                pygame.Rect((self.screen_width // 2) + 200,
                            self.screen_height - 40, 1800, 40), (0, 0, 0), 0,
                -0.099
            ],  # ground 2
            [
                pygame.Rect(self.screen_width // 2 - 150,
                            self.screen_height // 2 + 150, 100, 30), (0, 0, 0),
                0, -0.12
            ],  # stair 1
            [
                pygame.Rect(self.screen_width // 2 - 60,
                            self.screen_height // 2 + 100, 100, 30), (0, 0, 0),
                0, -0.12
            ],  # stair 2
            [
                pygame.Rect(self.screen_width // 2 + 50,
                            self.screen_height // 2 + 50, 100, 30), (0, 0, 0),
                0, -0.12
            ]  # stair 3
        ]
        for platform in level_platforms:
            self.platforms.add(Platform.from_list(platform))

        self.enemys.add(
            Slime(700, 441, VEC(3, 0), pygame.Rect(600, 400, 200, 40)))
        self.enemys.add(
            Slime(20, 181, VEC(3, 0),
                  pygame.Rect(0, screen_height - 400, 200, 40)))
Exemplo n.º 3
0
    def __init__(self, screen_height, screen_width):
        super().__init__(screen_height, screen_width)
        self.background = pygame.image.load(
            'Images/bg.jpg')  # where to get the background from
        self.platforms.empty()
        self.enemys.empty()
        self.dino_gun = False  # it shouldn't have a gun
        self.level_limit = -3530  #changes per level
        level_platforms = [
            [
                pygame.Rect(-5, 0, 5, screen_height),
                (0, 0, 0),
                0,
                -0.12  # left safety wall
            ],
            [
                pygame.Rect(0, screen_height - 40, 1960, 40),
                (0, 0, 0),
                0,
                -0.12  # ground
            ],
            [
                pygame.Rect(300, screen_height - 75, 217, 50),
                (0, 0, 0),
                0,
                -0.12  #first block
            ],
            [
                pygame.Rect(650, screen_height - 75, 615, 50),
                (0, 0, 0),
                0,
                -0.12  #second block
            ],
            [
                pygame.Rect(935, screen_height - 180, 60, 20),
                (0, 0, 0),
                0,
                -0.1  #special place ?what to put?
            ],
            [
                pygame.Rect(1347, screen_height - 130, 60, 20),
                (0, 0, 0),
                0,
                -0.12  #first air block
            ],
            [
                pygame.Rect(1500, screen_height - 180, 60, 20),
                (0, 0, 0),
                0,
                -0.12  #second air block
            ],
            [
                pygame.Rect(1660, screen_height - 230, 100, 205),
                (0, 0, 0),
                0,
                -0.12  #high ground
            ],
            [
                pygame.Rect(2100, screen_height - 40, 400, 40),
                (0, 0, 0),
                0,
                -0.12  # ground
            ],
            [
                pygame.Rect(2640, screen_height - 70, 60, 30),
                (0, 0, 0),
                0,
                -0.12  # air platform
            ],
            [
                pygame.Rect(2880, screen_height - 40, 200, 40),
                (0, 0, 0),
                0,
                -0.12  # ground
            ],
            [
                pygame.Rect(3047, screen_height - 130, 60, 20),
                (0, 0, 0),
                0,
                -0.12  #first air block
            ],
            [
                pygame.Rect(3200, screen_height - 180, 60, 20),
                (0, 0, 0),
                0,
                -0.12  #second air block
            ],
            [
                pygame.Rect(3360, screen_height - 230, 100, 205),
                (0, 0, 0),
                0,
                -0.12  #high ground
            ],
            [
                pygame.Rect(3360, screen_height - 40,
                            screen_width - self.level_limit, 40),
                (0, 0, 0),
                0,
                -0.12  # ground
            ],
        ]  #populate with platforms

        for platform in level_platforms:
            self.platforms.add(Platform.from_list(platform))