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

Re: [pygame] Yeah looks like i'm doing quite well so far, completed my goal for today.



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Lamonte Harris wrote:
> Okay I'm a bit confused with the whole surfaces[i].image I understand
> how to assign rects and all but what I mean is how would I go about
> making that class into a list?

In Python, lists contain other objects of any type. To access one of
the objects in the list, you use a subscript, like: "l[0]". Adding a
sprite to a list is no different from adding any other object to a
list. In your code, the way you did it was to create a variable box,
and then call something like "l.append(box)". So if I were you, I
would create the sprite, set the image and rect to some values, and
then call something like "l.append(sprite)".

Ethan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG5hgehRlgoLPrRPwRAmCVAJ9r41dEG7vJoQ9BYYtiAUvutEUU/gCdFBAx
x7YQZYCfuNIF3/ckxFHC6ow=
=ykWz
-----END PGP SIGNATURE-----