Package pygext :: Package gl :: Package director :: Module collision :: Class RadialCollisions
[frames | no frames]

Type RadialCollisions

object --+
         |
        RadialCollisions


Collision handler for circle-shaped objects

All entities registered to this handler must have their collision mask made up from one or more circles.
Method Summary
  __init__(self)
  add_node(self, groupname, parent, radius, x, y)
Add a new collision node for an entity.
  check_collisions(*args, **kwargs)
Check for collisions and call all registered collision functions.
  clear_nodes(self)
  draw_nodes(self)
  set_handler(self, group1, group2, func)
Set the collision handler function for two groups.
  start(self)
Start checking for collisions automatically every tick.
  stop(self)
Stop the automatic collision detection.

Method Details

add_node(self, groupname, parent, radius=None, x=0, y=0)

Add a new collision node for an entity.

groupname - name for the collision group, used for registering handler functions parent - parent Node to attach the collision node to radius - size of the collision circle x,y - position of the collision circle

If radius,x and y are not specified, the method tries to calculcate a suitable collision circle by using the Entity's shape's bounding rect.

Note that a single entity CAN have several collision circles to accomodate non-circular shapes.

check_collisions(*args, **kwargs)

Check for collisions and call all registered collision functions.

set_handler(self, group1, group2, func)

Set the collision handler function for two groups.

Register the function that will be called when entities from the specified groups collide. For performance, it is more efficient to specify the groups in few-to-many order. For example,

set_handler(self, "player", "enemies", player_collide)

start(self)

Start checking for collisions automatically every tick.

stop(self)

Stop the automatic collision detection.

Generated by Epydoc 2.1 on Mon Jun 12 18:21:20 2006 http://epydoc.sf.net