| |
- pygame.sprite.Sprite(__builtin__.object)
-
- Sprite
-
- Creature
-
- Enemy(Creature, Harmful)
- Player(Creature, Shooting)
- Exit
- Harmful
-
- Bullet
- Fire
- Powerup
- Shooting
- Wall
class Bullet(Harmful) |
| |
- Method resolution order:
- Bullet
- Harmful
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __init__(self, *args)
- allowcollision(self, sprite)
- expired(self)
- Returns True if the bullet has been expired.
- oncollide(self, other)
- Handle collision with sprite.
- update(self)
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- changes = True
- persistant = False
- priority = 10
- required = ['speed', 'lifetime', 'reloadtime']
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Creature(Sprite) |
|
Baseclass for all Brian inhabitants.
If canshoot is true, the getbullet() method should return a
subclass of Bullet which is used as the bullet. |
|
- Method resolution order:
- Creature
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __init__(self, *args)
- adjustmove(self, speed)
- adjustmove(speed) --> (speed, walls)
Returns a tuple of the true offset moved and the walls
which prevent it from moving the amount ordered. The true offset
moved is also influenced by the speed, which is an instance
attribute (speed).
- allowcollision(self, sprite)
- move(self, dir)
- Move according to given direction. Called by .control().
- oncollide(self, item)
- setplatform(self)
- Sets the platform attribute.
- shouldfall(self)
- Tells whether sprite should fall.
- standon(self, wall)
- takelive(self)
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- dir = [0, 0]
- persistant = True
- platform = None
- prevdir = [0, 0]
- priority = 50
- required = ['speed', 'mass', 'power', 'lives']
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Enemy(Creature, Harmful) |
|
Base class for all harmful creatures. |
|
- Method resolution order:
- Enemy
- Creature
- Harmful
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __init__(self, *args)
- allowcollision(self, sprite)
- turn(self)
- update(self)
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- changes = True
- priority = 50
- required = ['turnchance']
Methods inherited from Creature:
- adjustmove(self, speed)
- adjustmove(speed) --> (speed, walls)
Returns a tuple of the true offset moved and the walls
which prevent it from moving the amount ordered. The true offset
moved is also influenced by the speed, which is an instance
attribute (speed).
- move(self, dir)
- Move according to given direction. Called by .control().
- oncollide(self, item)
- setplatform(self)
- Sets the platform attribute.
- shouldfall(self)
- Tells whether sprite should fall.
- standon(self, wall)
- takelive(self)
Data and other attributes inherited from Creature:
- dir = [0, 0]
- persistant = True
- platform = None
- prevdir = [0, 0]
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Exit(Sprite) |
|
Exits the current level |
|
- Method resolution order:
- Exit
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- allowcollision(self, sprite)
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- persistant = True
- priority = 20
- required = []
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __init__(self, level, startpos, *args)
- Initializes Sprite class.
The first argument should be a Level instance. Usually, this is done
by Level.addsprite, and this method doesn't need to be called directly.
The second argument is the starting position.
All arguments from the third argument upwards are sprite specific
arguments, like their size or their path. This should be documented
in their respective docstrings.
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Fire(Harmful) |
| |
- Method resolution order:
- Fire
- Harmful
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __init__(self, level, startpos, size)
- allowcollision(self, sprite)
- oncollide(self, other)
Data and other attributes defined here:
- persistant = True
- priority = 40
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- allgroups = (<ControlledGroup(0 sprites)>,)
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- required = ['setimage', 'allgroups', 'required', 'oncollide', 'persistant', 'priority']
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Harmful(Sprite) |
|
Base class for all thats harmful to Brian. |
|
- Method resolution order:
- Harmful
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- allowcollision(self, sprite)
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __init__(self, level, startpos, *args)
- Initializes Sprite class.
The first argument should be a Level instance. Usually, this is done
by Level.addsprite, and this method doesn't need to be called directly.
The second argument is the starting position.
All arguments from the third argument upwards are sprite specific
arguments, like their size or their path. This should be documented
in their respective docstrings.
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- allgroups = (<ControlledGroup(0 sprites)>,)
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- required = ['setimage', 'allgroups', 'required', 'oncollide', 'persistant', 'priority']
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Player(Creature, Shooting) |
|
Base class for all that's controlled by a human. |
|
- Method resolution order:
- Player
- Creature
- Shooting
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __cmp__(self, other)
- allowcollision(self, spr)
- control(self, keys)
- Called by groups.ControlledGroup.
- oncollide(self, item)
- Handles collision with item.
- takelive(self)
- update(self)
Data and other attributes defined here:
- allgroups = (<GroupSingle(0 sprites)>,)
- changes = True
- level_completed = False
- living = True
- path = <Path.Path object>
- priority = 30
- required = ['score']
Methods inherited from Creature:
- __init__(self, *args)
- adjustmove(self, speed)
- adjustmove(speed) --> (speed, walls)
Returns a tuple of the true offset moved and the walls
which prevent it from moving the amount ordered. The true offset
moved is also influenced by the speed, which is an instance
attribute (speed).
- move(self, dir)
- Move according to given direction. Called by .control().
- setplatform(self)
- Sets the platform attribute.
- shouldfall(self)
- Tells whether sprite should fall.
- standon(self, wall)
Data and other attributes inherited from Creature:
- dir = [0, 0]
- persistant = True
- platform = None
- prevdir = [0, 0]
Methods inherited from Shooting:
- getbullet(self)
- PROTOCOL: Returns Bullet class.
Returns a class which is a subclass of Bullet.
Should be overloaded.
- shoot(self, direction)
- Shoots getbullet() in direction (self.speed if omitted).
Data and other attributes inherited from Shooting:
- shootframe = -2147483647
Methods inherited from Sprite:
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Powerup(Sprite) |
|
Base class for all that adds to the user's score. |
|
- Method resolution order:
- Powerup
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- allowcollision(self, sprite)
- oncollide(self, other)
- Handle collision with sprite.
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- persistant = True
- priority = 70
- required = ['points', 'ammo']
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __init__(self, level, startpos, *args)
- Initializes Sprite class.
The first argument should be a Level instance. Usually, this is done
by Level.addsprite, and this method doesn't need to be called directly.
The second argument is the starting position.
All arguments from the third argument upwards are sprite specific
arguments, like their size or their path. This should be documented
in their respective docstrings.
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Shooting(Sprite) |
|
Base class for all sprites that are able to shoot |
|
- Method resolution order:
- Shooting
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- getbullet(self)
- PROTOCOL: Returns Bullet class.
Returns a class which is a subclass of Bullet.
Should be overloaded.
- shoot(self, direction)
- Shoots getbullet() in direction (self.speed if omitted).
Data and other attributes defined here:
- required = ['getbullet', 'canshoot', 'ammo']
- shootframe = -2147483647
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __init__(self, level, startpos, *args)
- Initializes Sprite class.
The first argument should be a Level instance. Usually, this is done
by Level.addsprite, and this method doesn't need to be called directly.
The second argument is the starting position.
All arguments from the third argument upwards are sprite specific
arguments, like their size or their path. This should be documented
in their respective docstrings.
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- allowcollision(self, sprite)
- Returns True if a collision with sprite shouldn't have consequences.
Base classes may override this method, but should make sure
the parent .allowcollision() is called.
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- allgroups = (<ControlledGroup(0 sprites)>,)
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Sprite(pygame.sprite.Sprite) |
|
Base class for all Brian game objects.
Each class defines a 'required' attribute. This lists all attributes
the class requires to function and which should be set by subclasses.
Each class also has an 'allgroups' attribute. This lists all groups (defined
in the groups module) to which this sprite belongs, as well as all groups
its base(s) belong(s) to.
Some classes define a .control() method. If defined, this is called and
passed a Keys.Keys instance before .update() is called. |
|
- Method resolution order:
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __init__(self, level, startpos, *args)
- Initializes Sprite class.
The first argument should be a Level instance. Usually, this is done
by Level.addsprite, and this method doesn't need to be called directly.
The second argument is the starting position.
All arguments from the third argument upwards are sprite specific
arguments, like their size or their path. This should be documented
in their respective docstrings.
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- allowcollision(self, sprite)
- Returns True if a collision with sprite shouldn't have consequences.
Base classes may override this method, but should make sure
the parent .allowcollision() is called.
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties defined here:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes defined here:
- allgroups = (<ControlledGroup(0 sprites)>,)
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- required = ['setimage', 'allgroups', 'required', 'oncollide', 'persistant', 'priority']
- varsize = False
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
|
class Wall(Sprite) |
|
Base class for all thats neither penetrable nor harmful. |
|
- Method resolution order:
- Wall
- Sprite
- pygame.sprite.Sprite
- __builtin__.object
Methods defined here:
- __init__(self, level, startpos, size)
- oncollide(self, other)
Data and other attributes defined here:
- allgroups = (<Group(0 sprites)>,)
- persistant = True
- priority = 100
- varsize = True
Methods inherited from Sprite:
- __cmp__(self, other)
- Drawn in this order
- __getstate__(self)
- Alters the __dict__ so it can be Pickled
- __repr__(self)
- __setstate__(self, arg)
- Reverse of __getstate__
- allowcollision(self, sprite)
- Returns True if a collision with sprite shouldn't have consequences.
Base classes may override this method, but should make sure
the parent .allowcollision() is called.
- behindwall(self)
- True if this sprite is behind a wall
- collideswith(self)
- Returns a set of all objects this sprite collides with.
- docollisions(self)
- Posts events for all collisions and return information for redrawing.
- kill(self)
- Kills the sprite and removes the sprite from level.
- setrects(self, pos)
- Initializes outerrect and innerrect.
This method must be called after setimage
- update(self)
- Updates the sprite for internal usage. Should be called once
per frame. This is done by groups.ControlledGroup.update
- updatepg(self)
- Update PlacedGroup memberships if necessary.
Properties inherited from Sprite:
- image
- Return the correct image.
If self._image is a Surface, it is returned.
If it is an instance of ImageServer, the correct image is searched.
This finds place according to the following rules:
The direction are checked in the following order: first, the
current direction. Then, if applicable, the components of the
current direction. Then the centered direction. Then the previous
direction and its components. Finally, all other directions are
checked from NW to SE.
If this is the first frame of dir, and im.<dir>[0][0] exists, it
is returned. If 0 <= fm < len(im.<dir>[1]) (1 if im.<dir>[0][0]
exists) the appropiate frame is shown (im.<dir>[1][fm]). If fm >
len(im.<dir>[1]), and im.<dir>[2][0] exists, im.<dir>[2][0] is
returned. If im.<dir>[2][0] does not exist,
im.<dir>[fm % len(im.<dir>[1])] is shown.
Note: all items beyond the first of im.<dir>[0 or 2] are ignored.
- get = get(self)
- set = set(self, im)
- delete = del_(self)
- info
- All groups a sprite is member of and required attributes.
- get = get(self)
Data and other attributes inherited from Sprite:
- collisions = Set([])
- lastbehind = False
- offset = (0, 0, 0, 0)
- pgrects = []
- pgs = []
- pgtotalrect = <rect(0, 0, 0, 0)>
- required = ['setimage', 'allgroups', 'required', 'oncollide', 'persistant', 'priority']
Methods inherited from pygame.sprite.Sprite:
- add(self, group)
- add(group)
add a sprite to container
Add the sprite to a group or sequence of groups.
- add_internal(self, group)
- alive(self)
- alive() -> bool
ask the life of a sprite
Returns true if this sprite is a member of any groups.
- groups(self)
- groups() -> list
list used sprite containers
Returns a list of all the groups that contain this
sprite.
- remove(self, group)
- remove(group)
remove a sprite from container
Remove the sprite from a group or sequence of groups.
- remove_internal(self, group)
Data and other attributes inherited from pygame.sprite.Sprite:
- __dict__ = <dictproxy object>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Sprite' objects>
- list of weak references to the object (if defined)
| |