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

[pygame] rookie q about Sprites




> Should I make the 2 different pieces a class each and inherit from Sprite, 
> even if they are static ones that will not move.. (at least not yet?)

Yeah, for the sake of learning, I'd say you should be making them
sprites.  And put them in a RenderUpdates group while you're at it.

> Also, I suppose I better be careful here, cause I shouldn't need to load 
> that image and create a new instance everytime I click the board.. right?
> (Baaa, to early for this, need some coffee to make my braincells work.. ;)

Eventually, you will find that loading the same image each time affects
performance.  I'm of the "optimize last" school of thought, so I'd
suggest leaving it alone.  But it *is* really easy to either by making
it a class attribute or by making a "graphics" module that caches all
the images

I refer you to piman's excellent tutorial:
http://kai.vm.bytemark.co.uk/~piman/writing/sprite-tutorial.shtml