| |
- pygame.sprite.Group(__builtin__.object)
-
- PlacedGroup
- pygame.sprite.RenderUpdates(pygame.sprite.RenderClear)
-
- ControlledGroup
class ControlledGroup(pygame.sprite.RenderUpdates) |
|
Passes *args to 'control' method if available. |
|
- Method resolution order:
- ControlledGroup
- pygame.sprite.RenderUpdates
- pygame.sprite.RenderClear
- pygame.sprite.Group
- __builtin__.object
Methods defined here:
- __init__(self)
- add_internal(self, sprite)
- remove_internal(self, sprite)
- update(self, *args)
- Updates all sprites in group.
For each sprite, it checks whether is has a callable
'control' method. If so, it calls it, passing args.
For each sprite, it checks whether the 'changes' attrbute
is True. If so, it calls the update method of this sprite.
The result of this call is stored as the value in the
returned dictionairy. They key is the sprite, so the return
value is something like {<Sprite>: ..., <Sprite>: ...}.
Data and other attributes defined here:
- changes = Set([])
- controlled = Set([])
Methods inherited from pygame.sprite.RenderUpdates:
- draw(self, surface)
- draw(surface)
draw all sprites onto the surface
Draws all the sprites onto the given surface. It
returns a list of rectangles, which should be passed
to pygame.display.update()
Methods inherited from pygame.sprite.RenderClear:
- clear(self, surface, bgd)
- clear(surface, bgd)
erase the previous position of all sprites
Clears the area of all drawn sprites. the bgd
argument should be Surface which is the same
dimensions as the surface. The bgd can also be
a function which gets called with the passed
surface and the area to be cleared.
Methods inherited from pygame.sprite.Group:
- __len__(self)
- __len__() -> int
number of sprites in group
Returns the number of sprites contained in the group.
- __nonzero__(self)
- __nonzero__() -> bool
ask if group is empty
Returns true if the group has any sprites. This
lets you check if the group has any sprites by
using it in a logical if statement.
- __repr__(self)
- add(self, sprite)
- add(sprite)
add sprite to group
Add a sprite or sequence of sprites to a group.
- copy(self)
- copy() -> Group
copy a group with all the same sprites
Returns a copy of the group that is the same class
type, and has the same contained sprites.
- empty(self)
- empty()
remove all sprites
Removes all the sprites from the group.
- has(self, sprite)
- has(sprite) -> bool
ask if group has sprite
Returns true if the given sprite or sprites are
contained in the group
- remove(self, sprite)
- remove(sprite)
remove sprite from group
Remove a sprite or sequence of sprites from a group.
- sprites(self)
- sprites() -> iterator
return an object to loop over each sprite
Returns an object that can be looped over with
a 'for' loop. (For now it is always a list, but
newer version of python could return different
objects, like iterators.)
Data and other attributes inherited from pygame.sprite.Group:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Group' objects>
- list of weak references to the object (if defined)
|
class PlacedGroup(pygame.sprite.Group) |
|
Group with associated area.
All living sprites are in one or more PlacedGroups. When checking
for collisions, only the members of the PlacedGroups they're member
of (after moving) need to be checked. |
|
- Method resolution order:
- PlacedGroup
- pygame.sprite.Group
- __builtin__.object
Methods defined here:
- __init__(self, rect)
- __repr__(self)
Data and other attributes defined here:
- allpg = {}
Methods inherited from pygame.sprite.Group:
- __len__(self)
- __len__() -> int
number of sprites in group
Returns the number of sprites contained in the group.
- __nonzero__(self)
- __nonzero__() -> bool
ask if group is empty
Returns true if the group has any sprites. This
lets you check if the group has any sprites by
using it in a logical if statement.
- add(self, sprite)
- add(sprite)
add sprite to group
Add a sprite or sequence of sprites to a group.
- add_internal(self, sprite)
- copy(self)
- copy() -> Group
copy a group with all the same sprites
Returns a copy of the group that is the same class
type, and has the same contained sprites.
- empty(self)
- empty()
remove all sprites
Removes all the sprites from the group.
- has(self, sprite)
- has(sprite) -> bool
ask if group has sprite
Returns true if the given sprite or sprites are
contained in the group
- remove(self, sprite)
- remove(sprite)
remove sprite from group
Remove a sprite or sequence of sprites from a group.
- remove_internal(self, sprite)
- sprites(self)
- sprites() -> iterator
return an object to loop over each sprite
Returns an object that can be looped over with
a 'for' loop. (For now it is always a list, but
newer version of python could return different
objects, like iterators.)
- update(self, *args)
- update(...)
call update for all member sprites
calls the update method for all sprites in the group.
passes all arguments are to the Sprite update function.
Data and other attributes inherited from pygame.sprite.Group:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Group' objects>
- list of weak references to the object (if defined)
| |