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

RE: [pygame] Exact meaning of "sprite"



I've been going about doing sprite code in an unusual way for my own purposes. Does it make any sense?

Since I want a miniature physics sim handling events like collisions and gravity, without being locked into a particular graphics system, the main benefit of Pygame's standard Sprite class doesn't seem to apply: easy collision detection. I want collisions to be based on the official coordinates of the characters, rather than the pixel coordinates of their images on screen. So, I've built my own Sprite class. Am I right in seeing that the main purposes of the standard class are the collision detection and the ability to do groups (mostly for the same purpose)?

If nothing else, I've got useful code for chopping up a sprite sheet into animation frames referenced by number, so maybe I'll put that in the Cookbook.

Kris