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

## Class Multi

           object --+
                    |
               Sprite --+
                        |
                 Drawable --+
                            |
       object --+           |
                |           |
    AbstractGroup --+       |
                    |       |
                Group --+   |
                        |   |
            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.
| ``add`(self, group)` Add this sprite to a group.
| ``add_internal`(self, group)` add this sprite to a group
| ``addSprite`(self, sprite, xOffset, yOffset)` Add a sprite to this group.
| ``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.
| ``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.
| ``innerSprites`(self)` return all of the sprites in the group, except self.
| ``kill`(self)` kill() remove this sprite from all groups
| ``move`(self)` Move sprite to next location along path.
| `remove_internal(self, group)`
| ``removeSprite`(self, sprite)` Remove a sprite from this group.
| ``runPath`(self, frames)` Move along the path.
| ``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.
| ``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.
Inherited from Drawable
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.
| ``center`(self, x, y, dx, dy)` Align the Drawable in its layer
| ``direction`(self, point)` return the direction from the sprite to a point
| ``distance`(self, point)` return the distance from the sprite to a point
| ``get_position`(self)` return a copy of the sprite's position
| ``get_size`(self)` return size of sprite's rect.
| ``nudge`(self, dx, dy)` Move sprite.
| ``onscreen`(self, slack, **kw)` return True if image is on the screen or layer.
| ``pause`(self)` stop moving along Path
| ``set_crect`(self, crect)` set the collision `pygame.Rect` used for collision checking.
| ``set_positionRandom`(self, slack)` Move sprite to a random location on screen
| ``set_size`(self, size)` Set size of sprite's rect.
| ``solid`(self, other, move_both)` move sprite so that it does not overlap with other sprite
| ``stretch`(self, dx, dy, size, keepAspectRatio)` Change the size of sprite's image, and rect.
| ``unpause`(self)` start moving along Path
Inherited from Sprite
| ``__repr__`(self)`
| ``alive`(self)` alive() -> bool check to see if the sprite is in any groups
| ``groups`(self)` groups() -> list of groups list used sprite containers
| ``remove`(self, *groups)` remove(group or list of groups, ...) remove a sprite from container
| ``update`(self, *args)`
Inherited from AbstractGroup
| ``__contains__`(self, sprite)`
| ``__iter__`(self)`
| ``__len__`(self)` len(group) number of sprites in group
| ``__nonzero__`(self)`
| ``copy`(self)` copy() copy a group with all the same sprites
| ``has`(self, *sprites)` has(sprite or group, ...) ask if group has a sprite or sprites
| ``has_internal`(self, sprite)`
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

### __init__(self, w=None) (Constructor) Initialize Drawable sprite. Parameters: `w` - Layer on which sprite lives. Overrides: `pygsear.Drawable.Drawable.__init__` (inherited documentation)

### 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. Overrides: `pygame.sprite.Sprite.add`

### add_internal(self, group) add this sprite to a group Overrides: `pygame.sprite.Sprite.add_internal`

### 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`. Overrides: `pygsear.Drawable.Drawable.clear`

### 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`) Overrides: `pygsear.Drawable.Drawable.collide`

### 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`) Overrides: `pygsear.Drawable.Drawable.collidelist`

### 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`) Overrides: `pygsear.Drawable.Drawable.collidelistall`

### draw(self) Draw all of the sprites in the group. Returns: `pygame.Rect` which can be passed to `pygame.display.update` Overrides: `pygsear.Drawable.Drawable.draw`

### empty(self) empty() remove all sprites Removes all the sprites from the group. Overrides: `pygame.sprite.AbstractGroup.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() 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. Overrides: `pygame.sprite.Sprite.kill` (inherited documentation)

### move(self) Move sprite to next location along path. Overrides: `pygsear.Drawable.Drawable.move`

### 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`. Overrides: `pygsear.Drawable.Drawable.runPath`

### set_path(self, path) Set path for sprite to follow. Parameters: `path` - `Path.Path` Overrides: `pygsear.Drawable.Drawable.set_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. Overrides: `pygsear.Drawable.Drawable.set_position`

### sprites(self) return all of the sprites in the group (including self, since the group is itself a sprite). Overrides: `pygame.sprite.AbstractGroup.sprites`

### uclear(self) Erase all of the sprites in the group and update the screen. Overrides: `pygsear.Drawable.Drawable.uclear`

### udraw(self) Draw all of the sprites in the group and update the screen. Overrides: `pygsear.Drawable.Drawable.udraw`

Generated by Epydoc 2.0 on Fri Nov 11 14:26:38 2005 | http://epydoc.sf.net