Index

Package: Bodies

Description

package Physics.Bodies is

Classes

Corpus

type Corpus is new Object with private;

Ancestors:

Primitive operations:

Construct
Delete (overriding Objects.Delete)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
Objects.To_String (Inherited)
A physical representation of an entity, used by a Phsyics_Manager.

Types

A_Corpus

type A_Corpus is access all Corpus'Class;

Subprograms & Entries

Create_Corpus

function Create_Corpus
( id: Entity_Id;
width, height: Natural;
physical: Boolean;
clipped: Boolean;
manager: access Physics.Managers.Physics_Manager'Class ) return A_Corpus;
Creates a new corpus representing entity 'id', for use by 'manager'.

Detect_Collision

function Detect_Collision
( this: not null access Corpus'Class;
that: not null A_Corpus ) return Boolean;
Performs collision detection and returns True if this corpus is touching 'that' corpus. The objects are not modified.

Get_Id

function Get_Id
( this: not null access Corpus'Class ) return Entity_Id;
Returns the entity id the corpus represents.

Is_Touching

function Is_Touching
( this: not null access Corpus'Class;
that: not null A_Corpus ) return Boolean;
Returns True if 'that' corpus is in this corpus' touch list. No collision detection is performed.

Mark_Contact

procedure Mark_Contact
( this: not null access Corpus'Class;
that: not null A_Corpus;
inContact: Boolean );
Marks the contact state between this corpus and 'that'. The corpus' touch list will be updated. Set 'inContact' to true if the two corps are in contact with each other. Corpus 'that' is not modified.

Move_To

procedure Move_To
( this: not null access Corpus'Class;
map: not null A_Clip_Map;
x, y: Float );
Moves the entity to the given location. An Entity_Moved event is queued. Clipping is performed so an Entity_Grounded event may also be queued.

Set_AX

procedure Set_AX
( this: not null access Corpus'Class;
ax: Float );
Sets the acceleration in the X axis.

Set_AY

procedure Set_AY
( this: not null access Corpus'Class;
ay: Float );
Sets the acceleration in the Y axis.

Set_Clipped

procedure Set_Clipped
( this: not null access Corpus'Class;
clipped: Boolean );
Sets the clipped attribute of the Corpus. Clipped corps are bounded by the wall tiles of the map.

Set_Location

procedure Set_Location
( this: not null access Corpus'Class;
map: not null A_Clip_Map;
x, y: Float );
Sets the Corpus' location. No event is queued.

Set_Physical

procedure Set_Physical
( this: not null access Corpus'Class;
physical: Boolean );
Sets the physical attribute of the Corpus. Physical corps are affected by the forces of gravity and friction.

Set_Size

procedure Set_Size
( this: not null access Corpus'Class;
map: not null A_Clip_Map;
width, height: Natural );
Sets the physical size of the Corpus. The Corpus is clipped to 'map' immediately. An Entity_Resized event is queued.

Set_Target_VX

procedure Set_Target_VX
( this: not null access Corpus'Class;
vx: Float );
Sets the target velocity in the X axis to accelerate toward. This does not have an immediate effect on the velocity.

Set_Target_VY

procedure Set_Target_VY
( this: not null access Corpus'Class;
vy: Float );
Sets the target velocity in the Y axis to accelerate toward. This does not have an immediate effect on the velocity.

Set_Velocity

procedure Set_Velocity
( this: not null access Corpus'Class;
vx, vy: Float );
Sets the Corpus' velocity.

Tick

procedure Tick
( this: not null access Corpus'Class;
map: not null A_Clip_Map;
dt: Float;
collide: out Boolean );
Ticks the Corpus' changes in velocity and position and performs clipping. If 'collide' is returned True then the Corpus location changed and collision detection needs to be performed on it.

To_String

function To_String
( this: access Corpus'Class ) return String;
Returns a string representation of the Corpus.

Delete

procedure Delete
( this: in out A_Corpus );
Deletes the Corpus.