Package pygsear :: Module Drawable :: Class Multi
[show private | hide private]
[frames | no frames]

Class Multi

    object --+        
             |        
        Sprite --+    
                 |    
          Drawable --+
                     |
object --+           |
         |           |
     Group --+       |
             |       |
   RenderClear --+   |
                 |   |
     RenderUpdates --+
                     |
                    Multi


Made up of a group of sprites.

Create other Drawable instances, then addSprite() them in.

xOffset - x distance from left side of group base position. yOffset - y distance from top side of group base position.
Method Summary
  __init__(self, w)
Initialize Drawable sprite.
  __len__(self)
__len__() -> int number of sprites in group (inherited from Group)
a new object with type S, a subtype of T __new__(S, ...)
  __nonzero__(self)
__nonzero__() -> bool ask if group is empty (inherited from Group)
  __repr__(self)
(inherited from Sprite)
  add(self, group)
Add this sprite to a group.
  add_internal(self, group)
(inherited from Sprite)
  addSprite(self, sprite, xOffset, yOffset)
Add a sprite to this group.
  alive(self)
alive() -> bool ask the life of a sprite (inherited from Sprite)
bool can_see(self, target, blocking_rects_list)
Performs a los (line of sight) check from the center of the source to the center of the target. (inherited from Drawable)
  center(self, x, y, dx, dy)
Align the Drawable in its layer (inherited from Drawable)
  clear(self)
Erase all sprites in group to background
bool collide(self, other)
return True if this sprite and other sprite overlap.
Drawable or False collidelist(self, lothers)
return True if this sprite and any in list of others collide.
List collidelistall(self, lothers)
return True if this sprite and any in list of others collide.
  copy(self)
copy() -> Group copy a group with all the same sprites (inherited from Group)
  direction(self, point)
return the direction from the sprite to a point (inherited from Drawable)
  distance(self, point)
return the distance from the sprite to a point (inherited from Drawable)
  draw(self)
Draw all of the sprites in the group.
  empty(self)
empty() remove all sprites
  fix_neg_offsets(self, xo, yo)
try to correct for use of negative offset values when using addSprite.
  get_position(self)
return a copy of the sprite's position (inherited from Drawable)
  get_size(self)
return size of sprite's rect. (inherited from Drawable)
  groups(self)
groups() -> list list used sprite containers (inherited from Sprite)
  has(self, sprite)
has(sprite) -> bool ask if group has sprite (inherited from Group)
  innerSprites(self)
return all of the sprites in the group, except self.
  kill(self)
kill() end life of sprite, remove from all groups
  move(self)
Move sprite to next location along path.
  nudge(self, dx, dy)
Move sprite. (inherited from Drawable)
  onscreen(self, slack, **kw)
return True if image is on the screen or layer. (inherited from Drawable)
  pause(self)
stop moving along Path (inherited from Drawable)
  remove(self, group)
remove(group) remove a sprite from container (inherited from Sprite)
  remove_internal(self, group)
(inherited from Sprite)
  removeSprite(self, sprite)
Remove a sprite from this group.
  runPath(self, frames)
Move along the path.
  set_crect(self, crect)
set the collision pygame.Rectused for collision checking. (inherited from Drawable)
  set_path(self, path)
Set path for sprite to follow.
  set_position(self, location, *args)
Move sprite to location, and all contained sprites to their relative offsets from location.
  set_positionRandom(self, slack)
Move sprite to a random location on screen (inherited from Drawable)
  set_size(self, size)
Set size of sprite's rect. (inherited from Drawable)
  solid(self, other, move_both)
move sprite so that it does not overlap with other sprite (inherited from Drawable)
  sprites(self)
return all of the sprites in the group (including self, since the group is itself a sprite).
  stretch(self, dx, dy, size, keepAspectRatio)
Change the size of sprite's image, and rect. (inherited from Drawable)
  uclear(self)
Erase all of the sprites in the group and update the screen.
  udraw(self)
Draw all of the sprites in the group and update the screen.
  unpause(self)
start moving along Path (inherited from Drawable)
  update(self, *args)
(inherited from Sprite)

Method Details

__init__(self, w=None)
(Constructor)

Initialize Drawable sprite.
Parameters:
w - Layer on which sprite lives.
Overrides:
pygsear.Drawable.Drawable.__init__ (inherited documentation)

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

add(self, group)

Add this sprite to a group. NOT add a sprite to this group!
Parameters:
group - Sprite Group to add this sprite to.

addSprite(self, sprite, xOffset=0, yOffset=0)

Add a sprite to this group.

Note: does not work with negative offsets.
Parameters:
sprite - sprite to add to this group.
xOffset - x-distance from center sprite is displaced.
yOffset - y-distance from center sprite is displaced.

clear(self)

Erase all sprites in group to background

This does not return the affected pygame.Rect.

collide(self, other)

return True if this sprite and other sprite overlap.

Uses the .crect attribute of each sprite to check for a collision (overlap).
Parameters:
other - The other sprite to check for collision.
Returns:
True if the sprites overlap.
           (type=bool)

collidelist(self, lothers)

return True if this sprite and any in list of others collide.

The True value is the other sprite. Note that more than one sprite in the list may be colliding with the sprite, but only one is returned.
Parameters:
lothers - List of other sprites to check for collision.
Returns:
Other sprite if there is a collision, or False.
           (type=Drawable or False)

collidelistall(self, lothers)

return True if this sprite and any in list of others collide.

The True value is the list of colliding sprites, or if there is no collision, an empty sequence.
Parameters:
lothers - List of other sprites to check for collision.
Returns:
List of colliding sprites, or empty list.
           (type=List)

draw(self)

Draw all of the sprites in the group.
Returns:
pygame.Rect which can be passed to pygame.display.update

empty(self)

empty() remove all sprites

Removes all the sprites from the group.
Overrides:
pygame.sprite.Group.empty (inherited documentation)

fix_neg_offsets(self, xo, yo)

try to correct for use of negative offset values when using addSprite.

This is not working yet, and is not in use.

innerSprites(self)

return all of the sprites in the group, except self.

kill(self)

kill() end life of sprite, remove from all groups

Removes the sprite from all the groups that contain it. The sprite is still fine after calling this kill() so you could use it to remove a sprite from all groups, and then add it to some other groups.
Overrides:
pygame.sprite.Sprite.kill (inherited documentation)

move(self)

Move sprite to next location along path.

removeSprite(self, sprite)

Remove a sprite from this group.
Parameters:
sprite - Sprite to remove.

runPath(self, frames=0)

Move along the path. This is used only in an interactive session.
Parameters:
frames - Number of moves to make before raising Path.EndOfPath.

set_path(self, path)

Set path for sprite to follow.
Parameters:
path - Path.Path

set_position(self, location, *args)

Move sprite to location, and all contained sprites to their relative offsets from location.
Parameters:
location - Either a 2-tuple (x, y) or 2 numbers.

sprites(self)

return all of the sprites in the group (including self, since the group is itself a sprite).

uclear(self)

Erase all of the sprites in the group and update the screen.

udraw(self)

Draw all of the sprites in the group and update the screen.

Generated by Epydoc 1.1 on Sun Jan 25 19:10:09 2004 http://epydoc.sf.net