I have a little Problem with this code-snippet:
GrasTexture = pygame.image.load('Textures/Grounds/Gras.png')
StoneTexture = pygame.image.load('Textures/Grounds/Stone.png')
PathTexture = pygame.image.load('Textures/Grounds/Path.png')
SandTexture = pygame.image.load('Textures/Grounds/Sand.png')
SnowTexture = pygame.image.load('Textures/Grounds/Snow.png')
WaterTexture = pygame.image.load('Textures/Grounds/Water.png')
for i in range(936000):
if(mapList[i][0] == 0):
screen.blit(GrasTexture, (posX,posY))
elif(mapList[i][0] == 1):
screen.blit(StoneTexture, (posX,posY))
elif(mapList[i][0] == 2):
screen.blit(PathTexture, (posX,posY))
elif(mapList[i][0] == 3):
screen.blit(SandTexture, (posX,posY))
elif(mapList[i][0] == 4):
screen.blit(SnowTexture, (posX,posY))
elif(mapList[i][0] == 5):
screen.blit(WaterTexture, (posX,posY))
if(posX != 144000):
posX += 80
else:
posY += 80
posX = 0
The map was created like this:
list01 = [[0,0,0] for i in range(936000)]
f = open("map.txt", "w")
f.write(str(list01))
f.close()
f = open("map.txt", "r")
mapList = f.read()
mapList = ast.literal_eval(mapList)
f.close()
Here is the problem: When I change something in the mapList like mapList[0][0] = 4, the Texture doesn't change. But when I cut the for-loop out and replace the i by a 0. The Texture is right. So what is my Problem? Please help me!