Package springbots :: Module springbot :: Class Springbot
[hide private]

Class Springbot

source code


Springbot: Creature builded with nodes, which are masses, connected by springs which act like links between nodes pulling them together. Springs may also behave in a cicle muscle pulling and pushing the nodes it connects giving the creature some movement.

Instance Methods [hide private]
 
__getitem__(self, key)
Gets an info inten like a dictionary
source code
 
__init__(self, parent=None, name='Unnamed', startangle=0)
Creates a brand new creature or a descendent from a parent
source code
 
__iter__(self)
Iterate between _info values
source code
 
__len__(self)
Lenght(number of nodes)
source code
 
__repr__(self)
repr(x)
source code
 
__setitem__(self, key, value)
Gets an info inten like a dictionary
source code
 
add(self, objeto)
Adds an object: node or spring
source code
 
boundingBox(self, radius=8)
Calculates its bounding box limits
source code
 
centerGround(self, height)
Center springbot width and touch ground
source code
 
colide(self, other, radius=8)
Colides this springbot to another
source code
 
colideWall(self, limit, side, atr_normal=0.6, atr_surface=0.5, min_vel=0.99, radius=8)
Colides this springbot with a straigt wall
source code
 
draw(self, screen, ticks=None, track_x=False, track_y=False, backgroundcolor=(20, 10, 0), showText=True, extrainfo=None)
Draws Springbot using pygame engine.
source code
 
getNode(self, id)
Get node from id, None if id does not exists
source code
 
loadXML(self, file=sys.stdin)
Reads a xml into this springbot
source code
 
massCenter(self)
Calculates the center of mass
source code
 
refresh(self, atr=0.01, grav=(0, 0.3), elast=0.6, visc=0, moving=True)
Refreshes creature's state
source code
 
remove(self, objeto)
Remove an object: node or spring
source code
 
removeUnconnected(self)
Remove all nodes and springs unconnected
source code
 
storeXML(self, file=sys.stdin)
Store this springbot into a xml file
source code
 
unconnected(self)
Gets all unconnected nodes
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent=None, name='Unnamed', startangle=0)
(Constructor)

source code 

Creates a brand new creature or a descendent from a parent

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

draw(self, screen, ticks=None, track_x=False, track_y=False, backgroundcolor=(20, 10, 0), showText=True, extrainfo=None)

source code 

Draws Springbot using pygame engine. Use this function to show the springbot