def __init__(self, shape, scale, octave, pers, lac, water_level): # Inherits from the Perlin and Map classes Perlin.__init__(self, shape, scale, octave, pers, lac) Map.__init__(self, mode='RGB', size=shape) # Level below which the noise value is considered water self.waterLevel = water_level
def __init__(self): assets_dict = { "Tile": "Resources/Images/RedForestTile.png", "Background": "Resources/Images/ScaledBackgroundAutumnForest.png", "Spike": "Resources/Images/DesolateDesertSpike.png", "MontoyaFlag": "Resources/Images/MontoyaFlag.png", "ZorroFlag": "Resources/Images/ZorroFlag.png", "KingFlag": "Resources/Images/KingArthurFlag.png" } Map.__init__(self, 1000, 600, -130, 140, 675, 140, assets_dict, "redForestMap.txt") self.songName = "Red Forest"
def __init__(self, w=50, h=30, sd=randint(0, 9999999), loading_screen=(False, None)): Map.__init__(self, w, h, sd, 'filled', loading_screen=loading_screen) self.map_type = 'dungeon' self.room_count = 0 self.room_ids = [] self.rooms = {} self.tiles = {'wall': [], 'floor': [], 'corridor': [], 'door': []} self.tile_dict = { 'floor': 'floor', 'wall': 'hor_wall', 'filled': 'filled', 'fixed_wall': 'hor_wall', 'door': 'open_door', 'corridor': 'floor', 'w_feature': 'floor', 'nw_feature': 'floor' } # tunable stats for generation self.number_of_rooms = 30 self.number_of_extra_corridors = 10 # room style and size ranges self.room_distribution = { (0, 49): 'rect', (100, 100): 'square', (50, 69): 'rect_cross', (70, 99): 'alcove' } self.room_size = { 'rect': ((5, 15), (5, 9)), 'rect_cross': ((5, 15), (5, 9)), 'square': ((5, 12), (0, 1)), 'alcove': ((5, 12), (5, 10)) } self.tileset_id = 'brick' # initialize map self.generate_map() self.print_map()
def __init__(self, map_id, rows, columns): """ Initialises various attributes of level 1 :param columns: :param rows: """ Map.__init__(self, map_id, columns, rows, 5 * columns) self.fishes = [] self.moving_bridges = [] self.sub_holes = [] self.thrones = [] self.clouds = [] self.lake = None self.stones = [] self.extras = [] self.pole = None self.lives = [] self.up_wall = None self.down_wall = None print(self.length, self.columns, self.rows) print(config.MAP_LENGTH, config.COLUMNS, config.ROWS) self.create_walls() self.create_clouds() self.create_pole() self.create_lake_fishes() self.create_bridges() self.create_moving_bridges() self.create_holes() self.create_coins() self.create_enemies() self.create_extras() self.initial_player_position = { 'max_x': 4, 'max_y': self.up_wall.min_y - 1, 'min_x': 3, 'min_y': self.up_wall.min_y - 2 } self.create_checkpoints() self.player_crossed_start = False self.player_crossed_lake = False self.player_crossed_thrones = False
def __init__(self, w=50, h=30, sd=randint(0, 9999999), loading_screen=(False, None)): Map.__init__(self, w, h, sd, loading_screen=loading_screen) self.map_type = 'cave' self.tiles = {'wall': [], 'floor': [], 'door': []} self.tile_dict = { 'floor': 'floor', 'wall': 'hor_wall', 'filled': 'filled', 'fixed_wall': 'hor_wall', 'door': 'open_door', 'w_feature': 'floor', 'nw_feature': 'floor' } self.tileset_id = 'cavern1' # cellular automaton tuning stats self.open_noise = 45 self.number_of_passes = 3 self.opening_threshold = 4 self.closing_threshold = 3 self.automaton = ca.CellularAutomaton( (self.xlim, self.ylim), self.seed, self.open_noise, self.number_of_passes, self.opening_threshold, self.closing_threshold) self.generate_map() # self.tileset = self.load_tileset() self.print_map()
def __init__(self, cols, rows, frameWidth, frameHeight, widthMM, heightMM, title, menu = None, keybindings = []): """ TkMap extends Map and Tkinter """ Map.__init__(self, cols=cols, rows=rows, widthMM=widthMM, heightMM=heightMM) import pyrobot.system.share as share if not share.gui: share.gui = Tkinter.Tk() share.gui.withdraw() Tkinter.Toplevel.__init__(self,share.gui) self.wm_title(title) if menu == None: menu = [('File',[['Exit',self.destroy]])] self.menuButtons = {} self.debug = 0 self.application = 0 self.frameWidth = frameWidth self.frameHeight = frameHeight self.reScale() self.addMenu(menu) self.frame = Tkinter.Frame(self,relief=Tkinter.RAISED,borderwidth=2) self.frame.pack(side = "top", expand = "yes", fill = "both") self.canvas = Tkinter.Canvas(self.frame,width=self.frameWidth, height=self.frameHeight) self.canvas.pack(side = "top", expand = "yes", fill = "both") self.addKeyBindings(keybindings) self.protocol('WM_DELETE_WINDOW', self.destroy) self.update_idletasks() self.canvas.focus_set() self.canvas_width_diff = int(self.winfo_width()) - \ int(self.canvas["width"]) self.canvas_height_diff = int(self.winfo_height()) - \ int(self.canvas["height"])
def __init__(self, lines ): Map.__init__( self ) self.parse( lines )
def __init__(self, shape, scale, octave, pers, lac): # Inherits from the Perlin and Map classes Perlin.__init__(self, shape, scale, octave, pers, lac) Map.__init__(self, mode='1', size=shape)
def __init__(self, lat, lng, x_resolution, y_resolution, size_x, size_y, proj, pixel_to_km, GSD, x1, y1, x2, y3): Map.__init__(self, lat, lng, x_resolution, y_resolution, size_x, size_y, proj, pixel_to_km, GSD, x1, y1, x2, y3) self.heights = numpy.zeros((size_y, size_x), dtype=float)
def __init__(self, lat, lng, resolution, size, proj): Map.__init__(self, lat, lng, resolution, size, proj) self.heights = numpy.zeros((size, size), dtype=float)
def __init__(self, w=100, h=50, sd=randint(0, 9999999), default='holder', loading_screen=(False, None)): Map.__init__(self, w, h, sd, default, loading_screen=loading_screen) self.tiles = { 'ground': [], 'mountain': [], 'forest': [], 'water': [], 'depth': [] } self.tile_dict = { 'ground': 'ground', 'mountain': 'mountain', 'forest': 'forest', 'water': 'water', 'depth': 'depth', 'holder': 'holder' } self.tileset_id = 'world' self.shore_tiles = ts.TileSet('shore') self.shore_dict = {} self.map_image_ani = None # cellular automaton tuning stats self.open_noise = 45 self.number_of_passes = 2 self.opening_threshold = 5 self.closing_threshold = 3 self.special = None # have automaton run multiple times self.layers = 2 self.split = (False, True, False) self.num_continents = 5 self.num_islands = 4 self.island_threshold = 5 self.forest_seed = randint(0, 9999) self.automaton = ca.CellularAutomaton((self.xlim, self.ylim), self.seed, self.open_noise, self.number_of_passes, self.opening_threshold, self.closing_threshold, border=3, special=self.special, split=self.split) self.continents = {} self.islands = {} self.landmass_list = [] self.map_type = 'world' self.generate_map() self.print_map()