[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Creating large numbers of sprites in array or other structure
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Creating large numbers of sprites in array or other structure
- From: Ben Collier <bmcollier@xxxxxxxxx>
- Date: Mon, 26 Oct 2009 09:43:25 +0000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Mon, 26 Oct 2009 05:43:28 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=7svORqi3d4gEBmFrbd+4+ObR1MaH9IhUNWByavlgbpQ=; b=UC/P1ZI5DQZ8SohuD05IyA0R4PILsO1kHHftVLvOGsbPq2WVFWVxigOeqeLnafZjpL FYLB/segBJOZSUHL77MN34doCugr9adav9jetoHsITw5c23eNF7LyozV6sHy7zlJa2pL kZox8uYe3UHa09BwnCLYo9d0/QBb2VTHyiOU4=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=nhLMH19iT5yTvYlWaIAJFAfAJRjJ0aebKQvR6rXFRGyfRTNe0b5GamWns823Dxe2/H V0RjXOHHVxoxuTJTCCe8/XXSeOeIAg2700IGTOLIlCvukHHm4xhQkXwHmZ4w9Oda2W/z 7JzgBnuHAcsyn/cDXYNbVn/Mu+Dk15oDR0heg=
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi,
I'm fairly new to pygame, certainly haven't used it much, and up until now have been creating sprites by defining an extension to the sprite class and then instantiating each sprite by assigning it as, for example:
newsprite = NewSprite(250,250)
...with the arguments that the init method uses in brackets.
If I want to create, say, 150 sprites, and simply add each one to a group rather than having to have a distinct reference for each one, how do I do it? I can't seem to find an example online and I've not had much luck adding them to an array.
Thanks in advance,
Ben Collier