Guest User

Untitled

a guest
Jul 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. class Level(object):
  2. def __init__(self, rows, cols):
  3. self.levelid = 0
  4. self.rows = rows
  5. self.cols = cols
  6. self.tile_grid = []
  7. for y in range(self.rows):
  8. row = []
  9. for x in range(self.cols):
  10. row.append(None)
  11. self.tile_grid.append(row)
  12.  
  13. def set_tile(self, tile, v):
  14. self.tile_grid[tile[1]][tile[0]] = v
  15.  
  16. def get_tile(self, x, y):
  17. return self.tile_grid[y][x]
  18.  
  19. def load(self, group):
  20. group.empty()
  21. print self.tile_grid[0]
  22. for y in self.tile_grid:
  23. for x in self.tile_grid[y]:
  24. if x != None: group.add(Tile((x, y), tile_grid[y][x]))
Add Comment
Please, Sign In to add comment