Index

Package: Entities

Description

package Events.Entities is
Copyright (c) 2012 Kevin Wellwood All rights reserved. This source code is distributed under the Modified BSD License. For terms and conditions, see license.txt.

Classes

Entities_Event

type Entities_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
An event involving the interaction of two entities.

Accelerate_Event

type Accelerate_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A command to change the acceleration of an entity by Entity_Id.

Entity_Attribute_Event

type Entity_Attribute_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct (Inherited)
Construct
Delete (overriding Objects.Delete)
Events.Construct (Inherited)
Get_Attribute
Objects.Construct (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
An event involving an entity attribute.

Entity_Created_Event

type Entity_Created_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Adjust (overriding Objects.Adjust)
Construct (Inherited)
Construct
Delete (overriding Objects.Delete)
Events.Construct (Inherited)
Objects.Construct (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding To_String)
A notification that a new entity has been created.

Entity_Tile_Event

type Entity_Tile_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
An event involving the interaction of an entity with a tile.

Entity_Grounded_Event

type Entity_Grounded_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that an entity has landed on/left the ground.

Entity_Hit_Wall_Event

type Entity_Hit_Wall_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that a clipped entity collided with a wall and was stopped.

Entity_Moved_Event

type Entity_Moved_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that an entity moved.

Entity_Resized_Event

type Entity_Resized_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that an entity's physical size changed.

Frame_Changed_Event

type Frame_Changed_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A notification that an entity's display frame has changed.

Entity_Directive_Event

type Entity_Directive_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct (Inherited)
Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding To_String)
A command sent to an entity, either as a one-time action or ongoing until deactivated. The entity may choose to act on the directive depending on its current state.

Move_Entity_Event

type Move_Entity_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A command to move an entity.

Resize_Entity_Event

type Resize_Entity_Event is new Entity_Event with private;

Ancestors:

Primitive operations:

Construct
Construct (Inherited)
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (Inherited)
A command to change the physical size of an entity.

Spawn_Entity_Event

type Spawn_Entity_Event is new Event with private;

Ancestors:

Primitive operations:

Construct
Events.Construct (Inherited)
Objects.Adjust (Inherited)
Objects.Construct (Inherited)
Objects.Delete (Inherited)
Objects.Object_Read (Inherited)
Objects.Object_Write (Inherited)
To_String (overriding Events.To_String)
A command to create a new entity.

Types

A_Entity_Event

type A_Entity_Event is access all Entity_Event'Class;

A_Entities_Event

type A_Entities_Event is access all Entities_Event'Class;

A_Accelerate_Event

type A_Accelerate_Event is access all Accelerate_Event'Class;

A_Entity_Attribute_Event

type A_Entity_Attribute_Event is access all Entity_Attribute_Event'Class;

A_Entity_Created_Event

type A_Entity_Created_Event is access all Entity_Created_Event'Class;

A_Entity_Tile_Event

type A_Entity_Tile_Event is access all Entity_Tile_Event;

A_Entity_Grounded_Event

type A_Entity_Grounded_Event is access all Entity_Grounded_Event'Class;

A_Entity_Hit_Wall_Event

type A_Entity_Hit_Wall_Event is access all Entity_Hit_Wall_Event'Class;

A_Entity_Moved_Event

type A_Entity_Moved_Event is access all Entity_Moved_Event'Class;

A_Entity_Resized_Event

type A_Entity_Resized_Event is access all Entity_Resized_Event'Class;

A_Frame_Changed_Event

type A_Frame_Changed_Event is access all Frame_Changed_Event'Class;

A_Entity_Directive_Event

type A_Entity_Directive_Event is access all Entity_Directive_Event'Class;

A_Move_Entity_Event

type A_Move_Entity_Event is access all Move_Entity_Event'Class;

A_Resize_Entity_Event

type A_Resize_Entity_Event is access all Resize_Entity_Event'Class;

A_Spawn_Entity_Event

type A_Spawn_Entity_Event is access all Spawn_Entity_Event;

Constants & Global variables

DELETE_ENTITY_ID (Events.Event_Id)

DELETE_ENTITY_ID : constant Event_Id := To_Event_Id( "Delete_Entity" );
A command to delete an entity by Entity_Id.

ENTITY_DELETED_ID (Events.Event_Id)

ENTITY_DELETED_ID : constant Event_Id := To_Event_Id( "Entity_Deleted" );
A notification that an entity was deleted.

FOLLOW_ENTITY_ID (Events.Event_Id)

FOLLOW_ENTITY_ID : constant Event_Id := To_Event_Id( "Follow_Entity" );
A command to the game view follow an entity with the view's viewport.

ENTITIES_COLLIDED_ID (Events.Event_Id)

ENTITIES_COLLIDED_ID: constant Event_Id := To_Event_Id( "Entities_Collided" );
A notification that two entities collided (began touching).

ENTITIES_SEPARATED_ID (Events.Event_Id)

ENTITIES_SEPARATED_ID: constant Event_Id := To_Event_Id( "Entities_Separated" );
A notification that two entities separated (are no longer touching).

ACCELERATE_ID (Events.Event_Id)

ACCELERATE_ID : constant Event_Id := To_Event_Id( "Accelerate" );

ENTITY_ATTRIBUTE_CHANGED_ID (Events.Event_Id)

ENTITY_ATTRIBUTE_CHANGED_ID : constant Event_Id := To_Event_Id( "Entity_Attribute_Changed" );
A notification that an entity attribute has changed.

SET_ENTITY_ATTRIBUTE_ID (Events.Event_Id)

SET_ENTITY_ATTRIBUTE_ID : constant Event_Id := To_Event_Id( "Set_Entity_Attribute" );
A command to set an attribute of an entity.

ENTITY_CREATED_ID (Events.Event_Id)

ENTITY_CREATED_ID : constant Event_Id := To_Event_Id( "Entity_Created" );

ENTITY_ENTERED_TILE_ID (Events.Event_Id)

ENTITY_ENTERED_TILE_ID : constant Event_Id := To_Event_Id( "Entity_Entered_Tile" );
A notification that part of an entity's bounding rectangle entered a tile.

ENTITY_EXITED_TILE_ID (Events.Event_Id)

ENTITY_EXITED_TILE_ID : constant Event_Id := To_Event_Id( "Entity_Exited_Tile" );
A notification that no part of an entity's bounding rectangle is now touching a tile.

ENTITY_GROUNDED_ID (Events.Event_Id)

ENTITY_GROUNDED_ID : constant Event_Id := To_Event_Id( "Entity_Grounded" );

ENTITY_HIT_WALL_ID (Events.Event_Id)

ENTITY_HIT_WALL_ID : constant Event_Id := To_Event_Id( "Entity_Hit_Wall" );

ENTITY_MOVED_ID (Events.Event_Id)

ENTITY_MOVED_ID : constant Event_Id := To_Event_Id( "Entity_Moved" );

ENTITY_RESIZED_ID (Events.Event_Id)

ENTITY_RESIZED_ID : constant Event_Id := To_Event_Id( "Entity_Resized" );

FRAME_CHANGED_ID (Events.Event_Id)

FRAME_CHANGED_ID : constant Event_Id := To_Event_Id( "Frame_Changed" );

ENTITY_DIRECTIVE_ID (Events.Event_Id)

ENTITY_DIRECTIVE_ID : constant Event_Id := To_Event_Id( "Entity_Directive" );

MOVE_ENTITY_ID (Events.Event_Id)

MOVE_ENTITY_ID : constant Event_Id := To_Event_Id( "Move_Entity" );

RESIZE_ENTITY_ID (Events.Event_Id)

RESIZE_ENTITY_ID : constant Event_Id := To_Event_Id( "Resize_Entity" );

SPAWN_ENTITY_ID (Events.Event_Id)

SPAWN_ENTITY_ID : constant Event_Id := To_Event_Id( "Spawn_Entity" );

Subprograms & Entries

Get_Id

function Get_Id
( this: not null access Entity_Event'Class ) return Entity_Id;
Returns the Entity_Id of the entity involved in the event.

Get_A

function Get_A
( this: not null access Entities_Event'Class ) return Entity_Id;
Returns the Entity_Id of the first entity involved in the interaction, deemed entity A.

Get_B

function Get_B
( this: not null access Entities_Event'Class ) return Entity_Id;
Returns the Entity_Id of the second entity involved in the interaction, deemed entity B.

Get_Acceleration

function Get_Acceleration
( this: not null access Accelerate_Event'Class ) return Float;

Get_Direction

function Get_Direction
( this: not null access Accelerate_Event'Class ) return Cardinal_Direction;

Get_Velocity

function Get_Velocity
( this: not null access Accelerate_Event'Class ) return Float;

Get_Attribute

function Get_Attribute
( this: access Entity_Attribute_Event ) return String;
Returns the attribute name.

Get_Value

function Get_Value
( this: access Entity_Attribute_Event ) return Value_Ptr;
Returns a copy of the attribute value.

Get_Attributes

function Get_Attributes
( this: not null access Entity_Created_Event'Class ) return Assoc_Ptr;
Returns a copy of the entity's attributes as an association.

Get_Class

function Get_Class
( this: not null access Entity_Created_Event'Class ) return String;
Returns the entity's class name.

Get_Frame

function Get_Frame
( this: not null access Entity_Created_Event'Class ) return Natural;
Returns the entity's current display frame or 0 for none.

Get_Height

function Get_Height
( this: not null access Entity_Created_Event'Class ) return Natural;
Returns the physical height of the entity in world units.

Get_Lib_Name

function Get_Lib_Name
( this: not null access Entity_Created_Event'Class ) return String;
Returns the name of the library that contains the entity's frames.

Get_Width

function Get_Width
( this: not null access Entity_Created_Event'Class ) return Natural;
Returns the physical width of the entity in world units.

Get_X

function Get_X
( this: not null access Entity_Created_Event'Class ) return Float;
Returns the X coordinate of the entity in world coordinates.

Get_XV

function Get_XV
( this: not null access Entity_Created_Event'Class ) return Float;
Returns the X velocity of the entity in world units per second.

Get_Y

function Get_Y
( this: not null access Entity_Created_Event'Class ) return Float;
Returns the Y coordinate of the entity in world coordinates.

Get_YV

function Get_YV
( this: not null access Entity_Created_Event'Class ) return Float;
Returns the Y velocity of the entity in world units per second.

Is_Clipped

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

Is_Metaphysical

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

Is_Physical

function Is_Physical
( this: not null access Entity_Created_Event'Class ) return Boolean;
Returns True if physics apply to the entity, ie: gravity.

Get_X

function Get_X
( this: not null access Entity_Tile_Event'Class ) return Natural;
Returns the X location in tile coordinates.

Get_Y

function Get_Y
( this: not null access Entity_Tile_Event'Class ) return Natural;
Returns the Y location in tile coordinates.

Is_Grounded

function Is_Grounded
( this: not null access Entity_Grounded_Event'Class ) return Boolean;
Returns True if the entity landed on the ground or False if the entity left the ground.

Get_Direction

function Get_Direction
( this: not null access Entity_Hit_Wall_Event'Class ) return Cardinal_Direction;
Returns the direction that the entity was travelling when it hit the wall.

Is_First_Contact

function Is_First_Contact
( this: not null access Entity_Hit_Wall_Event'Class ) return Boolean;
Returns True if this is the entity's first contact with the wall in that direction. If the entity hits the wall and continues accelerating into it, pressing against it, then this will return False until the entity moves away from the wall and hits it again.

Get_X

function Get_X
( this: not null access Entity_Moved_Event'Class ) return Float;
Returns the entity's new X coordinate in world units.

Get_XV

function Get_XV
( this: not null access Entity_Moved_Event'Class ) return Float;
Returns the entity's X velocity in world units per second.

Get_Y

function Get_Y
( this: not null access Entity_Moved_Event'Class ) return Float;
Returns the entity's new Y coordinate in world units.

Get_YV

function Get_YV
( this: not null access Entity_Moved_Event'Class ) return Float;
Returns the entity's Y velocity in world units per second.

Get_Height

function Get_Height
( this: not null access Entity_Resized_Event'Class ) return Natural;
Returns the entity's new height in world units.

Get_Width

function Get_Width
( this: not null access Entity_Resized_Event'Class ) return Natural;
Returns the entity's new width in world units.

Get_Frame

function Get_Frame
( this: not null access Frame_Changed_Event'Class ) return Natural;
Returns the id of the new display frame or 0 for none.

Get_Directive

function Get_Directive
( this: not null access Entity_Directive_Event'Class ) return Hashed_String;
Returns the name of the directive being sent to the entity.

Get_Mode

function Get_Mode
( this: not null access Entity_Directive_Event'Class ) return Directive_Mode;
Returns the name of the directive being sent to the entity.

Get_X

function Get_X
( this: not null access Move_Entity_Event'Class ) return Float;
Returns the new X coordinate for the entity in world units.

Get_Y

function Get_Y
( this: not null access Move_Entity_Event'Class ) return Float;
Returns the new Y coordinate for the entity in world units.

Get_Height

function Get_Height
( this: not null access Resize_Entity_Event'Class ) return Natural;
Returns the new height for the entity in world units.

Get_Width

function Get_Width
( this: not null access Resize_Entity_Event'Class ) return Natural;
Returns the new width for the entity in world units.

Get_Height

function Get_Height
( this: access Spawn_Entity_Event ) return Integer;
Returns the physical height for the entity in world units.

Get_Id

function Get_Id
( this: access Spawn_Entity_Event ) return String;
Returns class id of the entity to create.

Get_Width

function Get_Width
( this: access Spawn_Entity_Event ) return Integer;
Returns the physical width for the entity in world units.

Get_X

function Get_X
( this: access Spawn_Entity_Event ) return Float;
Returns the X coordinate for the entity in world units.

Get_XV

function Get_XV
( this: access Spawn_Entity_Event ) return Float;
Returns the X velocity for the entity in world units per second.

Get_Y

function Get_Y
( this: access Spawn_Entity_Event ) return Float;
Returns the Y coordinate for the entity in world units.

Get_YV

function Get_YV
( this: access Spawn_Entity_Event ) return Float;
Returns the Y velocity for the entity in world units per second.

Queue_Accelerate

procedure Queue_Accelerate
( id: Entity_Id;
dir: Cardinal_Direction;
vel: Float;
acc: Float );
Queues an Accelerate event.

Queue_Delete_Entity

procedure Queue_Delete_Entity
( id: Entity_Id );
Queues a Delete_Entity event.

Queue_Entities_Collided

procedure Queue_Entities_Collided
( a, b: Entity_Id );
Queues an Entities_Collided event.

Queue_Entities_Separated

procedure Queue_Entities_Separated
( a, b: Entity_Id );
Queues an Entities_Separated event.

Queue_Entity_Attribute_Changed

procedure Queue_Entity_Attribute_Changed
( id: Entity_Id;
attribute: String;
val: Value_Ptr'Class );
Queues an Entity_Attribute_Changed event.

Queue_Entity_Created

procedure Queue_Entity_Created
( id: Entity_Id;
class: String;
physical, metaphysical, clipped: Boolean;
width, height: Natural;
x, y: Float;
xv, yv: Float;
libName: String;
frame: Natural;
attributes: Assoc_Ptr );
Queues an Entity_Created event. Argument 'attributes' is copied and not modified.

Queue_Entity_Deleted

procedure Queue_Entity_Deleted
( id: Entity_Id );
Queues an Entity_Deleted event.

Queue_Entity_Entered_Tile

procedure Queue_Entity_Entered_Tile
( id: Entity_Id;
x, y: Natural );
Queues an Entity_Entered_Tile event.

Queue_Entity_Exited_Tile

procedure Queue_Entity_Exited_Tile
( id: Entity_Id;
x, y: Natural );
Queues an Entity_Exited_Tile event.

Queue_Entity_Grounded

procedure Queue_Entity_Grounded
( id: Entity_Id;
grounded: Boolean );
Queues an Entity_Grounded event.

Queue_Entity_Hit_Wall

procedure Queue_Entity_Hit_Wall
( id: Entity_Id;
dir: Cardinal_Direction;
firstContact: Boolean );
Queues an Entity_Hit_Wall event. Set 'firstContact' True if the entity bumped into the wall, or False if the entity already made contact with the wall and is pressing itself against it.

Queue_Entity_Moved

procedure Queue_Entity_Moved
( id: Entity_Id;
x, y, xv, yv: Float );
Queues an Entity_Moved event.

Queue_Entity_Resized

procedure Queue_Entity_Resized
( id: Entity_Id;
width, height: Natural );
Queues an Entity_Resized event.

Queue_Entity_Directive

procedure Queue_Entity_Directive
( id: Entity_Id;
directive: Hashed_String;
mode: Directive_Mode );
Queues an Entity_Directive event to an entity.

Queue_Follow_Entity

procedure Queue_Follow_Entity
( id: Entity_Id );
Queues a Follow_Entity event.

Queue_Frame_Changed

procedure Queue_Frame_Changed
( id: Entity_Id;
frame: Natural );
Queues a Frame_Changed event.

Queue_Move_Entity

procedure Queue_Move_Entity
( id: Entity_Id;
x, y: Float );
Queues a Move_Entity event.

Queue_Resize_Entity

procedure Queue_Resize_Entity
( id: Entity_Id;
width, height: Natural );
Queues a Resize_Entity event.

Queue_Set_Entity_Attribute

procedure Queue_Set_Entity_Attribute
( id: Entity_Id;
attribute: String;
val: Value_Ptr'Class );
Queues a Set_Entity_Attribute event with a value of any type.

Queue_Spawn_Entity

procedure Queue_Spawn_Entity
( id: String;
x, y: Float;
width, height: Natural := 0;
xv, yv: Float := 0.0 );
Queues a Spawn_Entity event.