def __init__(self, game): name = "Isle2" self.mapimage = "greyfloor.png" wall_image = "wall1.png" isle_image = "emptyisle.png" start_pos = parse_pos((14, 19)) self.ambient_volume = 0.3 self.bgm = 'engine_slow.wav' super(Isle2, self).__init__(name, wall_image, isle_image, start_pos, game) self.southdoor1 = items.Door( dest_level="Start", pos=parse_pos((14, 20)), dest_startpos=parse_pos((14, 1)), ) self.northdoor1 = items.Door( dest_level="ThroneRoom", pos=parse_pos((14, 0)), dest_startpos=parse_pos((14, 19)), ) self.exit_sprites.add(self.southdoor1, self.northdoor1) for door in self.exit_sprites: game.blitter.register(door, self.name, layer=2)
def build_level(self): """Builds the "static" components of the level""" temp = None for i in self.sprites: if i[0] == "P": self.plat = platform.Platform((int(i[1]), int(i[2])), (int(i[3]), int(i[4]))) self.platforms.add(self.plat) elif i[0] == "B": self.plat = platform.Books((int(i[1]), int(i[2])), int(i[3])) self.platforms.add(self.plat) elif i[0] == "SP": self.spike = platform.Spikes((int(i[1]), int(i[2])), int(i[3])) self.spikes.add(self.spike) elif i[0] == "P2": self.plat = platform.Platform2((int(i[1]), int(i[2])), (int(i[3]), int(i[4])), i[5]) self.platforms2.add(self.plat) elif i[0] == "D": self.door = items.Door((int(i[1]), int(i[2])), len(self.doors) + 1) self.doors.add(self.door) elif i[0] == "MB": temp = platform.MovingBook((int(i[1]), int(i[2])), int(i[3]), (int(i[4]), int(i[5])), (int(i[6]), int(i[7]))) self.movingbooks.add(temp) elif i[0] == "S": self.player1.rect.bottomleft = ((int(i[1]), int(i[2]))) elif i[0] == "C": chair = platform.Chair((int(i[1]), int(i[2]))) self.chairs.add(chair) elif i[0] == "DoorPr": temp = items.PairedDoor((int(i[1]), int(i[2])), (int(i[3]), int(i[4]))) self.pairedDoors.add(temp) temp = items.PairedDoor((int(i[3]), int(i[4])), (int(i[1]), int(i[2]))) self.pairedDoors.add(temp) elif i[0] == "MiniDoor": temp = mini.MiniDoor(int(i[1]), (int(i[2]), int(i[3]))) self.miniDoor = temp if globes.Globals.LVL_NUM == 3: self.endS = items.EndS((5000, 200)) elif globes.Globals.LVL_NUM == 4: self.endS = items.EndS((4875, 220)) else: self.endS = items.EndS((3050, 100)) self.endRect = (self.endS.rect)
def make_rooms(): import room import items rooms = [] hallway = room.Room() hallway.name = "Hallway" hallway.empty([3, 9]) hallway.contents[0][1] = hallway_north_door = items.Door() hallway.contents[8][1] = hallway_south_door = items.Door() hallway.contents[4][0] = hallway_west_door = items.LockedDoor() hallway.contents[4][2] = hallway_east_door = items.Door() # TODO randomly link rooms together reactor_room = room.Room() reactor_room.name = "Reactor Room" reactor_room.empty([9, 9]) reactor_room.contents[0][3] = reactor_door = items.Door() reactor_room.contents[3][3] = items.ReactorPart() reactor_room.contents[4][3] = items.ReactorPart() reactor_room.contents[3][4] = items.ReactorPart() reactor_room.contents[4][4] = items.ReactorPart() reactor_room.contents[4][5] = box = items.Box() reactor_room.contents[5][4] = items.VentPanel() reactor_room.rads_per_sec = 80 box.inv.append(items.HealthPack()) note = items.Note() note.text = "137" observation_room = room.Room() observation_room.name = "Observation Room" observation_room.empty([8, 6]) observation_room.contents[1][1] = box = items.Box() observation_room.contents[3][0] = observation_door = items.Door() observation_room.contents[3][4] = items.DunkPanel() box.inv.append(items.HealthPack()) box.inv.append(items.Crowbar()) control_rod_room = room.Room() control_rod_room.name = "Control Rod Access" control_rod_room.rads_per_sec = 150 control_rod_room.contents = contents_from_text( 9, r""" ######### # # # # # # # # # # # # # # # ## ## ## ## ##### """, ) control_rod_room.contents[2][8] = control_rod_door = items.Door() control_rod_room.contents[5][4] = items.FluxPanel() control_rod_room.contents[3][4] = items.ControlRod() sleeping_quarters = room.Room() sleeping_quarters.contents = contents_from_text( 16, r""" ################ # # # # # # # # # # # # ### #### #### ## # # # # ################ """, ) sleeping_quarters.contents[7][14] = sleeping_quarters_door = items.Door() sleeping_quarters.contents[1][14] = box = items.Box() sleeping_quarters.name = "Sleeping Quarters" box.inv.append(items.HEVSuit()) # TODO: make more rooms link_doors(hallway, hallway_south_door, reactor_room, reactor_door) link_doors(hallway, hallway_east_door, observation_room, observation_door) link_doors(hallway, hallway_west_door, control_rod_room, control_rod_door) link_doors(hallway, hallway_north_door, sleeping_quarters, sleeping_quarters_door) rooms.append(sleeping_quarters) rooms.append(reactor_room) rooms.append(hallway) rooms.append(observation_room) rooms.append(control_rod_room) return rooms