level
index
/home/gerrit/cvs/brian/level.py

# $Id: level.html,v 1.13 2003/06/30 18:53:36 gerrit Exp $
#

 
Modules
       
DataServer
cPickle
copy
errors
groups
pygame
random
sets
usersprites
util

 
Classes
       
__builtin__.object
Background
Level
RandomLevel

 
class Background(__builtin__.object)
     Methods defined here:
__getstate__(self)
__repr__(self)
__setstate__(self, d)
clear(self)
find(self, myrect)
Find all background images
 
Returns a list of lists. Each list has 5 items:
[rect, name, image, mode, size]
set(self, rect, name, mode='tiled')
Sets image to rect with mode, overwriting previous images

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Background' objects>
list of weak references to the object (if defined)
data = {}

 
class Level(__builtin__.object)
     Methods defined here:
__getstate__(self)
__init__(self, size, name)
Create an empty level with size 'size'
__repr__(self)
__setstate__(self, d)
addsprite(self, cls, *args)
Add sprite with args to level. Returns the sprite object
border(self, w, wall=None)
Creates a border of width around the level. The wall
argument specifies a wall class to use (default SimpleWall).
save(self, f)
setplayer(self, cls, *args)
Add player with args to level.
 
Overwrites current player if existing.
spritesinrect(self, rect)
Returns a set of all sprites which collide with the
given rect object. This is especially useful to find
out which sprites collide with the current viewport (and
need to be drawn).
uncompile(self, f)
Writes text file that can be compile()d or edited.
update(self)
Updates the internal set of sprites.
 
This does not need to be called if all sprites were added
using the Level construction.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Level' objects>
list of weak references to the object (if defined)
gravity = 9.8100000000000005
player = None

 
class RandomLevel(Level)
    
Method resolution order:
RandomLevel
Level
__builtin__.object

Methods defined here:
__init__(self, size, nwalls, nlollys, nbears, nscaries, nexits, nfires, bsize=50, seed=None)
randsprite(self, spr, rect, n, tries, limited=(1, 1), *args)
Places n random spr sprites within rect passing *args.
randwall(self, minsize, maxsize, n=1, wall=None, tries=100)
randwall(minsize, maxsize, [n, wall, tries]) --> None
 
Places n random walls on this level. The size is uniformly
randomly chosen between minsize and maxsize. The class from
which the wall is chosen is 'wall' (default: SimpleWall),
and the number of tries after which it's given up is 'tries'.

Methods inherited from Level:
__getstate__(self)
__repr__(self)
__setstate__(self, d)
addsprite(self, cls, *args)
Add sprite with args to level. Returns the sprite object
border(self, w, wall=None)
Creates a border of width around the level. The wall
argument specifies a wall class to use (default SimpleWall).
save(self, f)
setplayer(self, cls, *args)
Add player with args to level.
 
Overwrites current player if existing.
spritesinrect(self, rect)
Returns a set of all sprites which collide with the
given rect object. This is especially useful to find
out which sprites collide with the current viewport (and
need to be drawn).
uncompile(self, f)
Writes text file that can be compile()d or edited.
update(self)
Updates the internal set of sprites.
 
This does not need to be called if all sprites were added
using the Level construction.

Data and other attributes inherited from Level:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Level' objects>
list of weak references to the object (if defined)
gravity = 9.8100000000000005
player = None

 
Functions
       
alternormal(n)
Returns random.normalvariate(n, n/5)
compile(f)
Compiles filename into a Level instance
load(fp)
Loads level instance from file, containing a pickled level.

 
Data
        __all__ = ['Level']
division = _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)