def create_pokemon_center(the_map): """ [2] [ ][1][ ] [0] """ zone0 = room(name="Front Door", desc=constants.enterance) zone0.add_feature(feature("Phone Booth", "Prop")) zone1 = room(name="Waiting Room", desc=constants.lounge) # includes PC feature zone1.add_feature(feature("Table", "Prop")).add_feature(feature("Chairs", "Prop")) zone1.add_feature(feature("Television", "Prop")).add_feature(feature("Bookshelf", "Prop")) zone2 = room(name="Center Desk", desc=constants.frontdesk) # where Nurse Joy and other staff meet trainers zone2.add_feature(feature("Nurse", "Person")).add_feature(feature("Notice Board", "Prop")) zone2.add_feature(feature("Healing Machine", "Prop")) zone0.connect_areas(zone1, constants.north, constants.south) zone1.connect_areas(zone2, constants.north, constants.south) zones = [zone0, zone1, zone2] the_map.current_area = zone0 the_map.areas = zones
def createRoom(roomData,regionPath,roomX,roomY): roomStandaloneLines, roomSections = getStandaloneLinesAndSections(roomData) roomConfigs = getValuePairs(roomStandaloneLines) requiredConfigs = [ # Required config variables for a room ['name',str], # List will be expanded as rooms become more complex ['x' ,int], ['y' ,int], ['BG' ,str], ['MG' ,str], ['FG' ,str], ] configsComplete,invalidPair = checkDictContents(roomConfigs,requiredConfigs) if not configsComplete: print("Error: room found without complete configuration in region (%s)"%regionPath) print("Missing or invalid config variable '%s' in room '%s,%s' with type '%s'"%(invalidPair[0],roomX,roomY,invalidPair[1])) raise ValueError roomName = roomConfigs['name'] roomXC = int(roomConfigs['x']) # different variable from roomX, to check that the positions defined here roomYC = int(roomConfigs['y']) # and when the room was declared agree with each other. roomBG = roomConfigs['BG'] roomMG = roomConfigs['MG'] roomFG = roomConfigs['FG'] if not ((roomXC == roomX) and (roomYC == roomY)): # make sure coordinants agree with each other print("Error room '%s,%s' found in region '%s' with contradictory coordinant declaration."%(roomX,roomY,regionPath)) raise ValueError roomMGData = None # I haven't added mid-ground roomFGData = None # or fore-ground data yet. if not ('bg_data') in roomSections.keys(): # make sure bg_data has been declared in this room print("Error: room '%s,%s' found without section 'bg_data' in region '%s'"%(roomX,roomY,regionPath)) raise ValueError roomBGData = processTileData(roomSections['bg_data']) if roomBGData == False: print("Error: room (%s,%s) found with invalid bg_data in region (%s)"%(roomX,roomY,regionPath)) raise ValueError return room( roomName, roomXC, roomYC, roomBG, roomMG, roomFG, roomBGData, roomMGData, roomFGData, )
def create_pokemon_center(the_map): ''' [2] [ ][1][ ] [0] ''' zone0 = room(name="Front Door", desc=constants.enterance) zone0.add_feature(feature("Phone Booth", "Prop")) zone1 = room(name="Waiting Room", desc=constants.lounge) # includes PC feature zone1.add_feature(feature("Table", "Prop")).add_feature(feature("Chairs", "Prop")) zone1.add_feature(feature("Television", "Prop")).add_feature( feature("Bookshelf", "Prop")) zone2 = room(name="Center Desk", desc=constants.frontdesk ) # where Nurse Joy and other staff meet trainers zone2.add_feature(feature("Nurse", "Person")).add_feature( feature("Notice Board", "Prop")) zone2.add_feature(feature("Healing Machine", "Prop")) zone0.connect_areas(zone1, constants.north, constants.south) zone1.connect_areas(zone2, constants.north, constants.south) zones = [zone0, zone1, zone2] the_map.current_area = zone0 the_map.areas = zones
def populate_map(the_map): ''' [6] [5] [4][3][2] [1] [0] ''' zone0 = room(name="Pallet Town", desc=constants.town) zone1 = room(name="Route 1", desc=constants.field_route) zone2 = room(name="Viridian City", desc=constants.city) zone3 = room(name="Route 22", desc=constants.valley_route) zone4 = room(name="Indigo Platue", desc=constants.pkm_stadium) zone5 = room(name="Route 2", desc=constants.forest_route) zone6 = room(name="Viridian Forest", desc=constants.forest) zones = [zone0, zone1, zone2, zone3, zone4, zone5, zone6] zone0.connect_areas(zone1, constants.north, constants.south) zone1.connect_areas(zone2, constants.north, constants.south) zone2.connect_areas(zone3, constants.west, constants.east) zone3.connect_areas(zone4, constants.west, constants.east) zone2.connect_areas(zone5, constants.north, constants.south) zone5.connect_areas(zone6, constants.north, constants.south) the_map.current_area = zone0 the_map.areas = zones
def populate_map(the_map): """ [6] [5] [4][3][2] [1] [0] """ zone0 = room(name="Pallet Town", desc=constants.town) zone1 = room(name="Route 1", desc=constants.field_route) zone2 = room(name="Viridian City", desc=constants.city) zone3 = room(name="Route 22", desc=constants.valley_route) zone4 = room(name="Indigo Platue", desc=constants.pkm_stadium) zone5 = room(name="Route 2", desc=constants.forest_route) zone6 = room(name="Viridian Forest", desc=constants.forest) zones = [zone0, zone1, zone2, zone3, zone4, zone5, zone6] zone0.connect_areas(zone1, constants.north, constants.south) zone1.connect_areas(zone2, constants.north, constants.south) zone2.connect_areas(zone3, constants.west, constants.east) zone3.connect_areas(zone4, constants.west, constants.east) zone2.connect_areas(zone5, constants.north, constants.south) zone5.connect_areas(zone6, constants.north, constants.south) the_map.current_area = zone0 the_map.areas = zones