Index

Package: Entities

Description

package Entities is

Classes

Entity (abstract)

type Entity is abstract new Object with private;

Ancestors:

Immediate Children:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct
Delete (overriding Objects.Delete)
Is_Permanent
Object_Input
Object_Read (overriding Objects.Object_Read)
Object_Write (overriding Objects.Object_Write)
Objects.Construct (Inherited)
On_Activate
On_Collide
On_Hit_Wall
On_Separate
Set_Attribute
To_String (overriding Objects.To_String)
Update_Frame

Types

Entity_Id

type Entity_Id is new Unsigned_32;

A_Entity

type A_Entity is access all Entity'Class;

Constants & Global variables

INVALID_ID (Entity_Id)

INVALID_ID : constant Entity_Id;

Subprograms & Entries

Activate

procedure Activate
( this: not null access Entity'Class;
activator: not null A_Entity );
Notifies the entity that it is being activated. To implement to handle this event, override On_Activate.

Collided

procedure Collided
( this: not null access Entity'Class;
e: not null A_Entity );
Notifies the entity that it has collided with 'e', updating the entity's touch list and calling On_Collide to invoke collision behavior. To add entity behavior on a collision event, override On_Collide.

Face

procedure Face
( this: access Entity;
dir: Direction_Type );
This procedure is called to change the direction the entity is facing. The default implementation is a null procedure so it must be overridden to provide some specific behavior.

Get_Attributes

function Get_Attributes
( this: not null access Entity'Class ) return A_Association;
Returns a reference to the entity's internal attributes association. The reference belongs to the entity, do not delete it!

Get_Direction

function Get_Direction
( this: not null access Entity'Class ) return Direction_Type;

Get_Frame

function Get_Frame
( this: not null access Entity'Class ) return Integer;

Get_Height

function Get_Height
( this: not null access Entity'Class ) return Integer;

Get_Id

function Get_Id
( this: not null access Entity'Class ) return Entity_Id;

Get_Lib_Name

function Get_Lib_Name
( this: not null access Entity'Class ) return String;

Get_Width

function Get_Width
( this: not null access Entity'Class ) return Integer;

Get_X

function Get_X
( this: not null access Entity'Class ) return Float;

Get_XV

function Get_XV
( this: not null access Entity'Class ) return Float;

Get_Y

function Get_Y
( this: not null access Entity'Class ) return Float;

Get_YV

function Get_YV
( this: not null access Entity'Class ) return Float;

Hit_Wall

procedure Hit_Wall
( this: not null access Entity'Class;
dir: Cardinal_Direction );
Notifies the entity that it hit a wall. To implement behavior to handle this event, override On_Hit_Wall.

Is_Clipped

function Is_Clipped
( this: not null access Entity'Class ) return Boolean;
Returns True if the entity is clipped to the walls in the world.

Is_Permanent

function Is_Permanent
( this: access Entity ) return Boolean;
Returns True if this entity is a permanent part of the world and isn't allowed to be deleted. The player, for example, is permanent.

Is_Metaphysical

function Is_Metaphysical
( this: not null access Entity'Class ) return Boolean;
Returns True if the entity is invisible, existing metaphysically.

Is_Physical

function Is_Physical
( this: not null access Entity'Class ) return Boolean;
Returns True if the entity is subject to the laws of physics.

Object_Input (abstract)

function Object_Input
( stream: access Root_Stream_Type'Class ) return Entity is abstract;
Reads an entity object from a stream and returns it. All concrete Entity subclasses must implement this function.

Separated

procedure Separated
( this: not null access Entity'Class;
e: not null A_Entity );
Notifies the entity that it as separated with 'e', updating the entity's touch list and calling On_Separate to invoke separation behavior. To add entity behavior on a separation event, override On_Separate.

Set_Attribute

procedure Set_Attribute
( this: access Entity;
name: String;
val: in out A_Value );
Sets an attribute of this entity. An Entity_Attribute_Changed event will be queued.

Set_Grounded

procedure Set_Grounded
( this: not null access Entity'Class;
grounded: Boolean );
Sets the grounded state of the entity. The entity's frame will be updated.

Set_Location

procedure Set_Location
( this: not null access Entity'Class;
x, y: Float );
Sets the entity's location without sending an event.

Set_Size

procedure Set_Size
( this: not null access Entity'Class;
width, height: Natural );
Sets the entity's size without sending an event.

Set_World

procedure Set_World
( this: not null access Entity'Class;
world: not null access Worlds.World_Object'Class );
Sets the entity's reference to the world in which it exists. This can never be set as null (although it will be null if Set_World is never called.) An exception will be raised if the entity already has a world reference.

Set_Velocity_X

procedure Set_Velocity_X
( this: not null access Entity'Class;
xv: Float );
Sets the entity's X velocity without sending an event. The entity's frame will be updated.

Set_Velocity_Y

procedure Set_Velocity_Y
( this: not null access Entity'Class;
yv: Float );
Sets the entity's Y velocity without sending an event. The entity's frame will be updated.

Tick

procedure Tick
( this: access Entity;
upTime, dt: Time_Span );

Allocate

function Allocate
( id: String ) return A_Entity;

Copy

function Copy
( src: A_Entity ) return A_Entity;

Delete

procedure Delete
( this: in out A_Entity );

Iterate_Classes

procedure Iterate_Classes
( pattern: String := "";
examine: access procedure( id : String ) );

Template

function Template
( id: String ) return A_Entity;

Initialize

procedure Initialize;

Finalize

procedure Finalize;