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

Re: [pygame] Pygame container for rectangles



If you are not using sprites, you can just iterate through a list like this example:
http://programarcadegames.com/index.php?chapter=introduction_to_animation&lang=en#section_8.2

If you are using sprites, you can create an update() method for that sprite, and then call update() on a sprite group. There's some talk about this in 14.2:
http://programarcadegames.com/index.php?chapter=introduction_to_sprites&lang=en#section_14

Or you can directly move them in a loop like this bullets example does:
http://programarcadegames.com/python_examples/show_file.php?file=bullets.py

Paul Vincent Craven


On Wed, Sep 4, 2013 at 7:11 AM, hallur <halluratlason@xxxxxxxxx> wrote:
I've drawn a couple of 20x20 rectangles on my screen, kind of like this:

#####
#####
#####
#####

and I want to move them all at once. I guess I could loop through all of
them and move them individually, but I figured there must be a container of
some sort I could put all of the rectangles in and then just move the
container.
So, my question is, is there such a container, and if so, how do I implement
it?

Any help is greatly appreciated!

Thanks in advance,
Hallur



--
View this message in context: http://pygame-users.25799.x6.nabble.com/Pygame-container-for-rectangles-tp864.html
Sent from the pygame-users mailing list archive at Nabble.com.