Package pygame :: Module sprite :: Class Sprite
[show private | hide private]
[frames | no frames]

Class Sprite

object --+
         |
        Sprite

Known Subclasses:
Drawable, Event, PSprite

The 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(self, *groups)
add(group or list of of groups, ...) add a sprite to container
  add_internal(self, group)
  alive(self)
alive() -> bool check to see if the sprite is in any groups
  groups(self)
groups() -> list of groups list used sprite containers
  kill(self)
kill() remove this sprite from all groups
  remove(self, *groups)
remove(group or list of groups, ...) remove a sprite from container
  remove_internal(self, group)
  update(self, *args)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)
    Inherited from type
  __new__(T, S, ...)
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.

Generated by Epydoc 2.0 on Sat Dec 9 14:11:20 2006 http://epydoc.sf.net