[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] lists of tuples



Hello everyone!

I feel as though I have been posting a lot of questions here. However,
my game engine is almost complete and is very much worth it! (You'll
see ... you'll ALL see... BHWHAHAHA)

My question:

I have a list of tuples that contains references to data inside my
sprite class (in this case, their positions), I would like to edit the
data in the tuple and have it change the data in the sprite, but this
is proving difficult with immutable tuples.

An example of my list would be:
myList = [(sprite1.position, "text"), (sprite2.position, "outpt")] 

I would like to do an operation something like:
myList[0][0] = (5,5)  #I know this is wrong for so many reasons

and have the the sprite1.position set to (5,5).

Is this achievable the way the list of tuples is currently set up?

Thanks,
Luke