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

Re: [pygame] roguelike question



> Well, the idea that you need to
> 
> "put it in a class"
> in order to
> "access it in the files that needed it"
> 
> is certainly not correct. You could do it that way, however like
> Marius says, that's a very strange usage.
> A more sensible usage could be:
> 1. Scrap the class, move the two functions out into the main scope of
> the 'Common' module (correspondingly removing the 'self' parameter)
> 2. Replace code like
> 
> c = Common.Common()
> 
> self.text, self.rect = c.draw_font(txt, color)
> 
> 
> with
> 
> self.text, self.rect = Common.draw_font(txt, color)
> 
> 
> 
> HTH.


Ah! Thank you! That is a lot clearer!


~Mike