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

RE: [pygame] Exact meaning of "sprite"



From a semantics view, a sprite is a single static image mapped over a
surface, whereas a spritemap is a single image consisting of (perhaps) many
different states of animation, of which only a part is visible at any given
time depending on which top-left xy coordinates are specified.

A sprite group is similar (or maybe even identical to) a spritemap. In terms
of pygame and sdl, it's a collection of static images that are mapped to the
same surface - OR - they are a collection of images that make up part of a
scene that are required to move in sync with each other.

For example, if you had background_sky and ground_tile images, and you
wanted an actor to walk from left to right whilst scrolling the
background_sky and ground_tile images to the left, it would be much more
manageable if they were in a sprite group and had their movement calls
"synchronised", rather than call movement functions on them individually.

The above is great for performing parallax scrolling demos, where you would
want three or more distinct "rows" of images all scrolling at different
speeds to give the illusion of depth.

-----Original Message-----
From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx]On
Behalf Of Terry Hancock
Sent: Wednesday, January 10, 2007 10:50
To: pygame-users@xxxxxxxx
Subject: [pygame] Exact meaning of "sprite"


I have a question about the "sprite" module and the use of "sprites" and
"sprite groups":

With an animated sprite -- saying a walking figure representing the
player -- is that one sprite with many surfaces representing each frame
of the walk cycle?  Or is that one "sprite group" with a separate sprite
for each walk cycle frame?

I realize you could probably do it either way, but I want to understand
what the intent was. Are sprite groups supposed to help with this kind
of animation or am I supposed to handle all of that in the class I
derive from Sprite?

Cheers,
Terry

-- 
Terry Hancock (hancock@xxxxxxxxxxxxxxxxxxxx)
Anansi Spaceworks http://www.AnansiSpaceworks.com




CONFIDENTIAL NOTICE: This email including any attachments, contains 
confidential information belonging to the sender. It may also be 
privileged or otherwise protected by work product immunity or other 
legal rules. This information is intended only for the use of the 
individual or entity named above.  If you are not the intended 
recipient, you are hereby notified that any disclosure, copying, 
distribution or the taking of any action in reliance on the contents 
of this emailed information is strictly prohibited.  If you have 
received this email in error, please immediately notify us by 
reply email of the error and then delete this email immediately.