예제 #1
0
 def draw_blocks(self):
     colour_list = ["red", "yellow", "green", "blue", "purple"]
     y_coord = 40
     start_x = 10
     for colour in colour_list:
         for i in range(0, 12):
             self.block_list.append(Entities.Block(start_x + 65 * i, y_coord, colour))
         y_coord += 20
         for i in range(0, 12):
             self.block_list.append(Entities.Block(start_x + 65 * i, y_coord, colour))
         y_coord += 20
예제 #2
0
def load_map():
    # TODO add gui to allow easy pickings
    # TODO use pickle with grid
    global entity_index
    global game_grid
    filename = "maps/gridfile2018-06-23 11:07:29.768659.txt"
    with open(filename, 'r') as level_file:
        for line in level_file:
            (col, row) = tuple(map(int, line.replace('\n', '').split(" ")))
            game_grid[row][col] = 1
            block = e.Block(entity_index, col * v.block_size, row * v.block_size)
            e.group.add(block)
            entity_index += 1

    game_grid = np.pad(game_grid, pad_width=v.padding, mode='constant', constant_values=-1)
    e.initgrid(game_grid)