oh, thanks

--- On Sun, 10/25/09, Henrique Nakashima <[email protected]> wrote:

From: Henrique Nakashima <[email protected]>
Subject: Re: [pygame] Is my code messy?
To: [email protected]
Date: Sunday, October 25, 2009, 1:57 PM

It doesn't look bad to me. If you want to improve it, though, a few suggestions:
- Break huge lines like
towersGroup.add(Tower("donut.png", random.randint(100, 
(screen.get_width()-32)),  random.randint(100, 
(screen.get_height()-32)),(random.randint(50,255),random.randint(50,255),random.randint(50,255))))

into pre calculations of the parameters, then passing the parameters.

- Most comments don't say more than the code line itself does, for example:
                self.rect.left = self.rect.left + self.speedx  #
                self.rect.top = self.rect.top + self.speedy    # add the speeds.
                target.kill() #destroy selected enemy

It is often said that code should be commented, but comments should be written 
for clarification and summarization of the code rather than for "having a 
commented code", IMO. Since Python code can be very clear and readable, as most 
of yours is, few comments are necessary.

- In case you wanna go picky, read http://www.python.org/dev/peps/pep-0008/It 
doesn't mean you should necessarily follow all these conventions, but some, 
especially the line spacing ones, would make the code more consistent.

On Sun, Oct 25, 2009 at 16:41, Yanom Mobis <[email protected]> wrote:

So ya, would this program be considered sloppy code? Zip archive attatched.




      




      

Reply via email to