[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 fixed it I had the x and y in the wrong spot:
> 
> self.create_box(self.map[z][q][0],self.map[z][q][1],(y,x))  is the
> correct method.

If you really mean for the variable "y" to mean "vertical position"
and the variable "x" to mean "horizontal position", as is often done
:), you might want to keep (x, y) but change the ways they get updated.

In fact, I would recommend significant changes to your whole design,
if you were planning to build on this. Instead of having a "surfaces"
array with two elements (surfaces and their rects), I would create a
"sprite" class which has both a surface and a rect. Then you could
just have a list of sprites. Keeping data in parallel arrays is
generally a bad idea -- what if you change one but forget to change
the other? Like delete the surface but forget the rect?

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

iD8DBQFG5gXrhRlgoLPrRPwRAm0cAJ45J36sIfd8KZDDDv75lZ6B5w4ssACeLFZZ
DZl4atSYBjk7YsPoYYm4elI=
=P+Qm
-----END PGP SIGNATURE-----