Advertisement
Guest User

Untitled

a guest
Feb 12th, 2013
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | None | 0 0
  1. MAP_WIDTH = 46
  2. MAP_HEIGHT = 20
  3.  
  4. smap = ['##############################################',
  5.         '#######################      #################',
  6.         '#####################    #     ###############',
  7.         '######################  ###        ###########',
  8.         '#############################             ####',
  9.         '################       ########    ###### ####',
  10.         '###############      #################### ####',
  11.         '################    ######                  ##',
  12.         '########   #######  ######   #     #     #  ##',
  13.         '########   ######      ###                  ##',
  14.         '########                                    ##',
  15.         '####       ######      ###   #     #     #  ##',
  16.         '#### ###   ########## ####                  ##',
  17.         '#### ###   ##########   ###########=##########',
  18.         '#### ##################   #####          #####',
  19.         '#### ###             #### #####          #####',
  20.         '####           #     ####                #####',
  21.         '########       #     #### #####          #####',
  22.         '########       #####      ####################',
  23.         '##############################################',
  24.         ]
  25.  
  26. class Tile:
  27.     #a tile of the map and its properties
  28.     def __init__(self, blocked, block_sight = False):
  29.         self.blocked = blocked
  30.  
  31.         #by default, if a tile is blocked, it also blocks sight
  32.         if block_sight == False: block_sight = blocked
  33.         self.block_sight = block_sight
  34.  
  35. def make_map():
  36.     global map, player
  37.  
  38.     #fill map with "blocked" tiles
  39.    
  40.     map = [[Tile(False)
  41.         for y in range(MAP_HEIGHT) ]
  42.             for x in range(MAP_WIDTH) ]
  43.            
  44.     for yy in range (MAP_HEIGHT):
  45.         for xx in range (21):
  46.             if smap[yy][xx]=='#':
  47.                 map[yy][xx]=Tile(True)
  48. make_map()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement