Package pajammin :: Module physics :: Class Body
[show private | hide private]
[frames | no frames]

Type Body

object --+
         |
        Body


An object in the physics engine. The physics engine's external interface exposes the following information about each body: The owner will be notified about physical events that occur to it. In particular:
Method Summary
  __init__(self, owner, bbox, is_solid, solid_sides, is_mobile)
  __repr__(self)
  jump(self, dx, dy, check_collisions)
  jump_to(self, x, y, check_collisions)
  move(self, dx, dy, report_collisions)
  move_to(self, x, y, report_collisions)
  set_bbox(self, bbox, check_collisions)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Property Summary
  bbox: A pygame Rect describing the current position of this body's bounding box.
  is_mobile: A flag indicating whether this is a mobile body.
  is_solid: A flag indicating whether this body can participate in collisions.
  owner: A pointer to the game entity that owns this body.
  support: The body that supports this body, or None if this body is not supported.
  support_side: The side of this body that it's support is on.
  supported_bodies: A list of the bodies that are supported by this body.
  xaccel: The x acceleration of the body, in pixels/sec^2.
  xvel: The x velocity of the body, in pixels/sec.
  yaccel: The y acceleration of the body, in pixels/sec^2.
  yvel: The y velocity of the body, in pixels/sec.

Instance Variable Summary
NoneType physics_engine: A pointer to the physics engine that manages this entity (if any).
  solid_sides: A set of flags indicating which sides of the body are 'solid.'

Method Details

__init__(self, owner, bbox, is_solid, solid_sides, is_mobile)
(Constructor)

Overrides:
__builtin__.object.__init__

__repr__(self)
(Representation operator)

Overrides:
__builtin__.object.__repr__

jump(self, dx, dy, check_collisions=True)

jump_to(self, x, y, check_collisions=True)

move(self, dx, dy, report_collisions=True)

move_to(self, x, y, report_collisions=True)

set_bbox(self, bbox, check_collisions=True)


Property Details

bbox

A pygame Rect describing the current position of this body's bounding box. Modifying this rect will *not* change the position of the body -- use move() or move_to() instead. (Read-only)
Get Method:
unknown-17285744(...)

is_mobile

A flag indicating whether this is a mobile body. If so, then it will have its position updated based on its velocity, and its velocity updated based on its acceleration. If not, then its velocity and acceleration are fixed at zero. Note that non-mobile bodies can still move if they are explicitly moved, or if a body that supports them moves. (Read-only)
Get Method:
unknown-17285808(...)

is_solid

A flag indicating whether this body can participate in collisions.
Get Method:
unknown-17286448(...)

owner

A pointer to the game entity that owns this body. This entity will be notified about physical events that occur to the body. (Read-only)
Get Method:
unknown-17286704(...)

support

The body that supports this body, or None if this body is not supported.
Get Method:
unknown-17286512(...)

support_side

The side of this body that it's support is on. E.g., if the player is standing on top of a platform, then its support will be the platform, and its support_side will be BOTTOM. support_side is expressed using the 'side' constants from pajammin.consts.
Get Method:
unknown-17286576(...)

supported_bodies

A list of the bodies that are supported by this body.
Get Method:
unknown-17286640(...)

xaccel

The x acceleration of the body, in pixels/sec^2.
Get Method:
unknown-17286256(...)

xvel

The x velocity of the body, in pixels/sec.
Get Method:
unknown-17286000(...)

yaccel

The y acceleration of the body, in pixels/sec^2.
Get Method:
unknown-17286384(...)

yvel

The y velocity of the body, in pixels/sec.
Get Method:
unknown-17286128(...)

Instance Variable Details

physics_engine

A pointer to the physics engine that manages this entity (if any). This is initialized by PhysicsEngine.add(). This pointer is used to perform actions that might impact other bodies (such as move()).
Type:
NoneType
Value:
None                                                                  

solid_sides

A set of flags indicating which sides of the body are 'solid.'