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

Re: [pygame] sprites in arrays, instead of simple variables



Hi,

Take a look at the group classes. This lets you manage the sprites easily.

http://www.pygame.org/docs/ref/sprite.html#pygame.sprite.Group

-Tyler

On Tue, Jul 7, 2009 at 8:55 AM, Paulo Silva <nitrofurano@xxxxxxxxx> wrote:
hi!
recently i coded this humble snipped using sprites from subsurfaces:
http://pastebin.com/f2b05bf70

the question is: it seems to be simple working with just 4 different
sprites, one in each variable - but when they are hundreds or
thousands, this task become to be very boring - can we store sprites
into arrays instead of simple variables?

another question: this example became slow when the ammount of sprites
on screen are 256 or more, on a Pentium4-sse2 (i'm using Ubuntu Linux
9.04) - is there some way to speed up this task, and allowing as much
as 1000 sprites or more for this? (i'm interested on trying to start
coding those bullet-hell doujin shumps, and this snippet were for
testing how many sprites we can count with for this kind of game
development)

thanks! :)



--
Visit my blog at http://oddco.ca/zeroth/zblog