--
-- 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.
--
package Entities.Players is
type Player is abstract new Entity with private;
type A_Player is access all Player'Class;
-- Notifies the player that something deadly happened to it and it should
-- die. The player entity may choose to do nothing if it is currently
-- invincible. This procedure must be overridden to provide an
-- implementation.
procedure Die( this : access Player ) is abstract;
-- Notifies the player entity that a "start movement" impulse in direction
-- 'dir' was received. This procedure must be overridden to provide an
-- implementation.
procedure Move_Start( this : access Player; dir : Cardinal_Direction ) is abstract;
-- Notifies the player entity that a "stop movement" impulse in direction
-- 'dir' was received. This procedure must be overridden to provide an
-- implementation.
procedure Move_Stop( this : access Player; dir : Cardinal_Direction ) is abstract;
private
type Player is abstract new Entity with
record
alive : Boolean := True;
moving : Direction_Booleans := Direction_Booleans'(others => False);
end record;
-- Constructs the Player object. Subclass constructors should call this
-- procedure first.
procedure Construct( this : access Player;
width,
height : Natural;
libName : String );
procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Player );
for Player'Read use Object_Read;
procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Player );
for Player'Write use Object_Write;
end Entities.Players;