> Pardon my comment but that code looks kinda nasty from the perspective > of an outside potential user of your API :)
I agree, and I am looking for ways to improve it, so I really appreciate your suggestions. > class Player(GameObject): > fps = behavior.FPS( > keys=dict(left=key.A, right=key.D, forward=key.W, > backward=key.S), > ) > > where behavior.FPS is something appropriate and then scrape the class > for special attributes in the GameObject.__init__ But wouldn't fps then be a static attribute? What if different players need different sets of keys? I would actually clean it up a bit to look like this, now that I think about it: > class Player(GameObject): > def __init__(self, x, y): > super(Player, self).__init__(util.resourcevault.character, x=x, y=y) > self.fps = behavior.manual.FPS(self, keys=dict(left=key.A, > right=key.D, forward=key.W, backward=key.S) Is that better? I don't know why I didn't think to do that before...anyway, that's an easy fix, so I'll go implement it now, and by the time you read this, it should be in the repository already. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en -~----------~----~----~----~------~----~------~--~---
