How to make a tilemap in pygame?
7. Červen 2024 v 11:16
so I have some Python code to generate a random 10x10 grid in which a mine will be or won't be placed, I am having trouble trying to convert this list into a use-able set of coordinates. Any help would be appreciated
fieldx = 10
fieldy = 10
objecs = 20
Field = []
for i in range(fieldy):
Field.append([])
for j in range(fieldx):
Field[i].append([0])
for i in range(objecs):
x = random.randint(0,fieldx-1)
y = random.randint(0,fieldy-1)
if Field[y][x] == [0]:
Field[y][x] = [1]