コード例 #1
0
ファイル: level3.py プロジェクト: chipx86/foreverend
class Outside40000000AD(Level3OutsideArea):
    def __init__(self, *args, **kwargs):
        super(Outside40000000AD, self).__init__(*args, **kwargs)
        self.bluebox = Door('40000000ad/bluebox')

    def draw_bg(self, surface):
        surface.fill((209, 186, 151))
        moon = load_image('40000000ad/moon')
        surface.blit(moon, (surface.get_width() - 150, 40))

    def setup(self):
        level_width, level_height = self.size

        lava_name = '65000000bc/lava_pool'
        tiles_x = level_width / load_image(lava_name).get_width()
        lava = TiledSprite('65000000bc/lava_pool', tiles_x, 1)
        lava.lethal = True
        self.main_layer.add(lava)
        lava.move_to(0, level_height - lava.rect.height)

        cliff = Sprite('40000000ad/cliff_left')
        cliff.use_pixel_collisions = True
        self.main_layer.add(cliff)
        cliff.move_to(0, level_height - cliff.rect.height)

        self.main_layer.add(self.bluebox)
        self.bluebox.move_to(60, cliff.rect.top - self.bluebox.rect.height)
        self.bluebox.destination = self.time_period.areas['bluebox'].door

        cliff = Sprite('40000000ad/cliff_middle')
        cliff.use_pixel_collisions = True
        self.main_layer.add(cliff)
        cliff.move_to(1720, level_height - cliff.rect.height)
コード例 #2
0
class Outside1000AD(Level2OutsideArea):
    def __init__(self, *args, **kwargs):
        super(Outside1000AD, self).__init__(*args, **kwargs)
        self.pyramid_door = Door('1000ad/pyramid_door')

    def draw_bg(self, surface):
        surface.fill((255, 251, 219))

    def setup(self):
        level_width, level_height = self.size

        tiles_x = self.size[0] / 144
        ground = TiledSprite('1000ad/ground', tiles_x, 1)
        self.main_layer.add(ground)
        ground.move_to(0, level_height - ground.rect.height)

        cactus = Cactus()
        self.main_layer.add(cactus)
        cactus.move_to(100, ground.rect.top - cactus.rect.height)

        pyramid = Sprite('1000ad/pyramid')
        self.bg_layer.add(pyramid)
        pyramid.move_to(922, ground.rect.top - pyramid.rect.height)

        cactus = Cactus()
        self.main_layer.add(cactus)
        cactus.move_to(pyramid.rect.left + 100,
                       ground.rect.top - cactus.rect.height)

        cactus = Cactus()
        self.main_layer.add(cactus)
        cactus.move_to(2600, ground.rect.top - cactus.rect.height)

        self.pyramid_door.destination = self.time_period.areas['pyramid'].door
        self.main_layer.add(self.pyramid_door)
        self.pyramid_door.move_to(
            pyramid.rect.left + 621,
            pyramid.rect.bottom - self.pyramid_door.rect.height)

        snake = Snake()
        self.main_layer.add(snake)
        snake.move_to(pyramid.rect.left - snake.rect.width,
                      ground.rect.top - snake.rect.height)

        # Artifact
        self.level.add_artifact(self, cactus.rect.right + 100, ground.rect.top)
コード例 #3
0
class Pyramid1000AD(Level2PyramidArea):
    def __init__(self, *args, **kwargs):
        super(Pyramid1000AD, self).__init__(*args, **kwargs)
        self.door = Door('1000ad/pyramid_door')
        self.ground_name = '1000ad/ground'
        self.wall_name = '1000ad/pyramid_wall'
        self.spike_name = '1000ad/spike'

    def draw_bg(self, surface):
        surface.fill((255, 251, 219))

    def setup(self):
        super(Pyramid1000AD, self).setup()

        self.door.destination = self.time_period.areas['default'].pyramid_door
        self.main_layer.add(self.door)
        self.door.move_to(self.DOOR_X, self.ground_top - self.door.rect.height)

        x = self.topleft_platform.rect.left
        y = self.topleft_platform.rect.top

        flip_count = 0
        flip = False

        for i in range(8):
            step = TiledSprite(self.wall_name, 4, 1)
            self.main_layer.add(step)

            if flip:
                x += step.rect.width
            else:
                x -= step.rect.width

            flip_count += 1

            if flip_count == 3:
                flip_count = 0
                flip = not flip

            y += 2 * step.rect.height
            step.move_to(x, y)
コード例 #4
0
ファイル: level3.py プロジェクト: chipx86/foreverend
class BlueBoxArea(Area):
    size = (1024, 768)
    def __init__(self, *args, **kwargs):
        super(BlueBoxArea, self).__init__(*args, **kwargs)
        self.key = 'bluebox'
        self.door = Door('40000000ad/bluebox_door')

    def draw_bg(self, surface):
        surface.fill((193, 198, 251))

    def setup(self):
        area_width, area_height = self.size

        ground = Box(area_width, 60, (83, 107, 143))
        self.main_layer.add(ground)
        ground.move_to(0, area_height - ground.rect.height)

        ceiling = Box(area_width, 60, (83, 107, 143))
        self.main_layer.add(ceiling)
        ceiling.move_to(0, 0)

        wall_height = area_height - ground.rect.height - ceiling.rect.height + 2
        wall_y = ceiling.rect.bottom - 1

        left_wall = Box(60, wall_height, (83, 107, 143))
        self.main_layer.add(left_wall)
        left_wall.move_to(0, wall_y)

        right_wall = Box(60, wall_height, (83, 107, 143))
        self.main_layer.add(right_wall)
        right_wall.move_to(area_width - right_wall.rect.width, wall_y)

        self.main_layer.add(self.door)
        self.door.move_to(left_wall.rect.right + 100,
                          ground.rect.top - self.door.rect.height)
        self.door.destination = self.time_period.areas['default'].bluebox

        # Reverse gravity background
        reverse_grav_bg = Sprite('300ne/bluebox_reverse_gravity_bg')
        self.bg_layer.add(reverse_grav_bg)
        reverse_grav_bg.move_to(left_wall.rect.right, ceiling.rect.bottom)

        # Reverse gravity area
        gravity_eventbox = EventBox(self)
        gravity_eventbox.rects.append(reverse_grav_bg.rect)
        gravity_eventbox.watch_object_moves(self.level.engine.player)
        gravity_eventbox.object_entered.connect(
            lambda obj: obj.set_reverse_gravity(True))
        gravity_eventbox.object_exited.connect(
            lambda obj: obj.set_reverse_gravity(False))
        gravity_eventbox.object_moved.connect(
            lambda obj: obj.set_reverse_gravity(True))

        teleporter1 = BlueBoxTeleporter()
        self.main_layer.add(teleporter1)
        teleporter1.move_to(right_wall.rect.left - teleporter1.rect.width - 20,
                            ground.rect.top - teleporter1.rect.height)

        teleporter2 = BlueBoxTeleporter()
        teleporter2.reverse_gravity = True
        self.main_layer.add(teleporter2)
        teleporter2.move_to(left_wall.rect.right + 20, ceiling.rect.bottom)

        teleporter1.destination = teleporter2
        teleporter2.destination = teleporter1

        self.main_layer.add(self.level.triangle_key)
        self.level.triangle_key.move_to(
            right_wall.rect.left - self.level.triangle_key.rect.width - 40,
            ceiling.rect.bottom)
        self.level.triangle_key.set_reverse_gravity(True)