| Home | Trees | Index | Help |
|---|
| Package pygame :: Module sprite :: Class Sprite |
|
object --+
|
Sprite
Drawable,
Event,
PSpriteThe base class for your visible game objects. The sprite class is meant to be used as a base class for the objects in your game. It just provides functions to maintain itself in different groups.
You can initialize a sprite by passing it a group or sequence of groups to be contained in.
When you subclass Sprite, you must call this pygame.sprite.Sprite.__init__(self) before you add the sprite to any groups, or you will get an error.| Method Summary | |
|---|---|
__init__(self,
*groups)
| |
__repr__(self)
| |
add(group or list of of groups, ...) add a sprite to container | |
add_internal(self,
group)
| |
alive() -> bool check to see if the sprite is in any groups | |
groups() -> list of groups list used sprite containers | |
kill() remove this sprite from all groups | |
remove(group or list of groups, ...) remove a sprite from container | |
remove_internal(self,
group)
| |
update(self,
*args)
| |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Inherited from type | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
| Method Details |
|---|
add(self, *groups)add(group or list of of groups, ...) add a sprite to container Add the sprite to a group or sequence of groups. |
alive(self)alive() -> bool check to see if the sprite is in any groups Returns true if this sprite is a member of any groups. |
groups(self)groups() -> list of groups list used sprite containers Returns a list of all the groups that contain this sprite. These are not returned in any meaningful order. |
kill(self)kill() remove this sprite from all groups Removes the sprite from all the groups that contain it. The sprite still exists after calling this, so you could use it to remove a sprite from all groups, and then add it to some other groups. |
remove(self, *groups)remove(group or list of groups, ...) remove a sprite from container Remove the sprite from a group or sequence of groups. |
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.0 on Fri Nov 11 14:26:39 2005 | http://epydoc.sf.net |