def setup(self): level_width, level_height = self.size # Ground tiles_x = self.size[0] / 32 ground = TiledSprite("ground", tiles_x, 1) self.main_layer.add(ground) ground.move_to(0, self.size[1] - ground.rect.height) building_rect = self.BUILDING_RECT.move(0, ground.rect.top - self.BUILDING_RECT.height) # Building background building_bg = Box(*building_rect.size) self.bg_layer.add(building_bg) building_bg.move_to(*building_rect.topleft) # First floor floor1 = Box(building_rect.width, self.GROUND_HEIGHT, self.FLOOR_COLOR) self.main_layer.add(floor1) floor1.move_to(building_rect.left, ground.rect.top) # Second floor floor2 = Box(building_rect.width, self.GROUND_HEIGHT, self.FLOOR_COLOR) self.main_layer.add(floor2) floor2.move_to(building_rect.left, building_rect.top + (building_rect.height - floor2.rect.height) / 2) # Left wall of building box = Box(self.WALL_WIDTH, building_rect.height, self.WALL_COLOR) self.main_layer.add(box) box.move_to(building_rect.left, building_rect.top) # Right wall of the building right_wall = Box(self.WALL_WIDTH, building_rect.height, self.WALL_COLOR) self.main_layer.add(right_wall) right_wall.move_to(building_rect.right - self.WALL_WIDTH, building_rect.top) # Ceiling box = Box(building_rect.width, self.GROUND_HEIGHT) self.main_layer.add(box) box.move_to(building_rect.left, building_rect.top) # Top elevator elevator1 = Elevator() self.main_layer.add(elevator1) elevator1.move_to(building_rect.left + 100, building_rect.top - elevator1.rect.height) # Bottom elevator elevator2 = Elevator() self.main_layer.add(elevator2) elevator2.move_to(elevator1.rect.left, floor2.rect.top - elevator2.rect.height) # Link up the elevators elevator1.destination = elevator2 elevator2.destination = elevator1 # Dynamite self.main_layer.add(self.level.dynamite) self.level.dynamite.move_to( right_wall.rect.left - self.level.dynamite.rect.width - 20, floor2.rect.top - self.level.dynamite.rect.height, ) # self.level.dynamite.move_to( # 200, ground.rect.top - self.level.dynamite.rect.height) # Mountain mountain = Mountain() mountain.add_to(self) mountain.move_to(1300, ground.rect.top - mountain.rect.height) platform = Sprite("1999ad/lavamatics_platform") self.main_layer.add(platform) platform.move_to(1841, mountain.rect.bottom - platform.rect.height - 500) platform = Sprite("1999ad/l_tube") self.main_layer.add(platform) platform.move_to(2140, mountain.rect.bottom - platform.rect.height - 450)
def setup(self): self.exploding = False self.exploded = False ground = TiledSprite("ground", self.size[0] / 32, 1) self.main_layer.add(ground) ground.move_to(0, self.size[1] - ground.rect.height) hills = Sprite("65000000bc/hills_1") self.bg_layer.add(hills) hills.move_to(0, ground.rect.top - hills.rect.height) # Volcano self.volcano = Volcano() self.volcano.add_to(self) self.volcano.move_to(1400, ground.rect.top - self.volcano.rect.height + 1) blocker = Box(150, self.size[1] - self.volcano.rect.height - 20, (0, 0, 0, 0)) self.main_layer.add(blocker) blocker.move_to(self.volcano.lava_pool.rect.right - 100, 0) # Left-side lava pool lava_pool = TiledSprite("65000000bc/lava_pool", 5, 1) lava_pool.lethal = True self.main_layer.add(lava_pool) lava_pool.move_to(self.volcano.rect.left - lava_pool.rect.width - 100, ground.rect.top - 18) # Platforms platform = FloatingSprite("65000000bc/platform") self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 250, lava_pool.rect.top - 10) platform = FloatingSprite("65000000bc/platform") self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 500, lava_pool.rect.top - 8) platform = FloatingSprite("65000000bc/platform") self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 750, lava_pool.rect.top - 12) # Right-side lava pool lava_pool = TiledSprite("65000000bc/lava_pool", 3, 1) lava_pool.lethal = True self.main_layer.add(lava_pool) lava_pool.move_to(self.volcano.rect.right + 200, ground.rect.top - 18) # Dynamite explosion trigger explosion_box = EventBox(self) explosion_box.rects.append( pygame.Rect( self.volcano.lava_puddle.rect.x, self.volcano.lava_puddle.rect.bottom - 5, self.volcano.lava_puddle.rect.width, 5, ) ) explosion_box.watch_object_moves(self.level.dynamite) explosion_box.object_entered.connect(self.on_dynamite_placed) # Artifact self.level.add_artifact(self, lava_pool.rect.right + 200, ground.rect.top)
def setup(self): level_width, level_height = self.size # Ground tiles_x = self.size[0] / 32 ground = TiledSprite('ground', tiles_x, 1) self.main_layer.add(ground) ground.move_to(0, self.size[1] - ground.rect.height) building_rect = self.BUILDING_RECT.move( 0, ground.rect.top - self.BUILDING_RECT.height) # Building background building_bg = Box(*building_rect.size) self.bg_layer.add(building_bg) building_bg.move_to(*building_rect.topleft) # First floor floor1 = Box(building_rect.width, self.GROUND_HEIGHT, self.FLOOR_COLOR) self.main_layer.add(floor1) floor1.move_to(building_rect.left, ground.rect.top) # Second floor floor2 = Box(building_rect.width, self.GROUND_HEIGHT, self.FLOOR_COLOR) self.main_layer.add(floor2) floor2.move_to(building_rect.left, building_rect.top + (building_rect.height - floor2.rect.height) / 2) # Left wall of building box = Box(self.WALL_WIDTH, building_rect.height, self.WALL_COLOR) self.main_layer.add(box) box.move_to(building_rect.left, building_rect.top) # Right wall of the building right_wall = Box(self.WALL_WIDTH, building_rect.height, self.WALL_COLOR) self.main_layer.add(right_wall) right_wall.move_to(building_rect.right - self.WALL_WIDTH, building_rect.top) # Ceiling box = Box(building_rect.width, self.GROUND_HEIGHT) self.main_layer.add(box) box.move_to(building_rect.left, building_rect.top) # Top elevator elevator1 = Elevator() self.main_layer.add(elevator1) elevator1.move_to(building_rect.left + 100, building_rect.top - elevator1.rect.height) # Bottom elevator elevator2 = Elevator() self.main_layer.add(elevator2) elevator2.move_to(elevator1.rect.left, floor2.rect.top - elevator2.rect.height) # Link up the elevators elevator1.destination = elevator2 elevator2.destination = elevator1 # Dynamite self.main_layer.add(self.level.dynamite) self.level.dynamite.move_to( right_wall.rect.left - self.level.dynamite.rect.width - 20, floor2.rect.top - self.level.dynamite.rect.height) #self.level.dynamite.move_to( # 200, ground.rect.top - self.level.dynamite.rect.height) # Mountain mountain = Mountain() mountain.add_to(self) mountain.move_to(1300, ground.rect.top - mountain.rect.height) platform = Sprite('1999ad/lavamatics_platform') self.main_layer.add(platform) platform.move_to(1841, mountain.rect.bottom - platform.rect.height - 500) platform = Sprite('1999ad/l_tube') self.main_layer.add(platform) platform.move_to(2140, mountain.rect.bottom - platform.rect.height - 450)
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)
def setup(self): self.exploding = False self.exploded = False ground = TiledSprite('ground', self.size[0] / 32, 1) self.main_layer.add(ground) ground.move_to(0, self.size[1] - ground.rect.height) hills = Sprite('65000000bc/hills_1') self.bg_layer.add(hills) hills.move_to(0, ground.rect.top - hills.rect.height) # Volcano self.volcano = Volcano() self.volcano.add_to(self) self.volcano.move_to( 1400, ground.rect.top - self.volcano.rect.height + 1) blocker = Box(150, self.size[1] - self.volcano.rect.height - 20, (0, 0, 0, 0)) self.main_layer.add(blocker) blocker.move_to(self.volcano.lava_pool.rect.right - 100, 0) # Left-side lava pool lava_pool = TiledSprite('65000000bc/lava_pool', 5, 1) lava_pool.lethal = True self.main_layer.add(lava_pool) lava_pool.move_to(self.volcano.rect.left - lava_pool.rect.width - 100, ground.rect.top - 18) # Platforms platform = FloatingSprite('65000000bc/platform') self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 250, lava_pool.rect.top - 10) platform = FloatingSprite('65000000bc/platform') self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 500, lava_pool.rect.top - 8) platform = FloatingSprite('65000000bc/platform') self.main_layer.add(platform) platform.move_to(lava_pool.rect.left + 750, lava_pool.rect.top - 12) # Right-side lava pool lava_pool = TiledSprite('65000000bc/lava_pool', 3, 1) lava_pool.lethal = True self.main_layer.add(lava_pool) lava_pool.move_to(self.volcano.rect.right + 200, ground.rect.top - 18) # Dynamite explosion trigger explosion_box = EventBox(self) explosion_box.rects.append( pygame.Rect(self.volcano.lava_puddle.rect.x, self.volcano.lava_puddle.rect.bottom - 5, self.volcano.lava_puddle.rect.width, 5)) explosion_box.watch_object_moves(self.level.dynamite) explosion_box.object_entered.connect(self.on_dynamite_placed) # Artifact self.level.add_artifact(self, lava_pool.rect.right + 200, ground.rect.top)