ted b wrote:

> Here's the code i am using, but its a lot of if /
> thens and i'm trying to find a better way:
> 
>       if var1.value > var2.value > var3.value: 
>          objSprites = pygame.sprite.OrderedUpdates
> (var1, var2, var3)

Did you see Evert's reply to your original question? It was pretty close 
to the mark. Though you had not said anything about the .value 
attributes until now.

Try this:
from operator import attrgetter
vars = [ var1, var2, var3 ]
vars.sort(key=attrgetter('value'))
objSprites = pygame.sprite.OrderedUpdates(*vars)

This will sort the vars list by the value attribute of each list item, 
then pass the list as the parameter list to OrderedUpdates().

Kent

PS Please use Reply All to reply to the list.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to