It's a classic error when you have not learn how to use objects in Python correctly
You must know that in Python, when you do this :
>>> list = []
>>> print(list)
[]
>>> list2 = list
>>> list.append(5)
>>> print(list)
[5]
>>> print(list2)
[5]
Both lists are the same.
It's exacly what happen when you append your list with the sprite. You modify the position of the same sprite always.
This is a solution :
import sfml as sf
def stageLoader():
texture = sf.Texture.from_file("Brown Block.png")
spriteMap = []
for xtile in range(8):
for ytile in range(4):
tileSprite = sf.Sprite(texture)
tileSprite.position = (xtile*100, ytile*170)
spriteMap.append(tileSprite)
return spriteMap
stageMap = stageLoader()
for tile in range(len(stageMap)):
print(stageMap[tile].position)
I create a new object each time (with the same name, but it's still a new instance).
And remove your "try: ... except: ..." if you got an error in this block, how can you know that ? You'll got an error farther, and you'll don't know that it's just here.
Have a nice day !