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

Re: [pygame] sprite engine



Geekius Maximus schrieb:
Cindy,
I am currently working on a sprite rendering engine as well, and I really appreciate that you're passing these ideas around, they've been really helpful. I have just one question for you, though. How do you get the images to blit in a specific order? Do you have one class containing all of the sprites, which blits only the dirty sprites and those that are blitted on top of the dirty sprites?


------------------------------------------------------------------------
Yahoo! Messenger with Voice. <http://us.rd.yahoo.com/mail_us/taglines/postman3/*http://us.rd.yahoo.com/evt=39666/*http://messenger.yahoo.com> PC-to-Phone calls for ridiculously low rates.
Hi


I have a layerdict = {layerNr:[spritelist], ...} and go thtrough this like:


layerkeys = layerdict.keys(): layerkeys.sort() for layer in layerkeys: for sprite in layerdict[layer]: .... # do stuff here


I have a own list for the sortet layerkeys and only sort it if a layer ist added or removed. (do not sort it every frame)



Geekius Maximus: do you publish your code? (URL?) Would like to take a look, if you let me.


Cindy: never considered to use OpenGL? (like pygext at http://codereactor.net/projects/pygext/ , especially if the entire background changes every frame)


~DR0ID