1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2.  
  3. package Entities.Enemies is 
  4.  
  5.     type Enemy is abstract new Entity with private; 
  6.     type A_Enemy is access all Enemy'Class; 
  7.  
  8.     -- Returns a reference to a bitmap icon that represents the enemy. The 
  9.     -- returned reference is owned by the enemy. Do not modify it! 
  10.     function Get_Icon( this : access Enemy ) return A_Bitmap; 
  11.  
  12.     -- Returns True if the enemy is shootable (meaning it blocks shots fired at 
  13.     -- it.) Being shootable does not imply that the enemy will react in any 
  14.     -- specific way if instructed to die. 
  15.     function Is_Shootable( this : not null access Enemy'Class ) return Boolean; 
  16.  
  17.     -- Notify the enemy that something deadly happened to it and it should die. 
  18.     -- If the enemy is not currently capable of dying, nothing should happen. 
  19.     -- The default behavior is to do nothing. Override this procedure to cause 
  20.     -- the enemy to react in some way. 
  21.     procedure Die( this : access Enemy ); 
  22.  
  23.     -- A class pattern that matches all enemy class ids registered in the entity 
  24.     -- factory. 
  25.     CLASS_PATTERN : constant String := "Entities.Enemies.*"; 
  26.  
  27. private 
  28.  
  29.     type Enemy is abstract new Entity with 
  30.         record 
  31.             icon        : Integer := 0;        -- used by KEd 
  32.             deadlyTouch : Boolean := True;     -- is the enemy deadly to the player? 
  33.             shootable   : Boolean := True;     -- can the player's shots hit it? 
  34.         end record; 
  35.  
  36.     -- Raises an exception on error. 
  37.     procedure Construct( this     : access Enemy; 
  38.                          width, 
  39.                          height   : Natural; 
  40.                          libName  : String; 
  41.                          iconName : String ); 
  42.  
  43.     procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Enemy ); 
  44.     for Enemy'Read use Object_Read; 
  45.  
  46.     procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Enemy ); 
  47.     for Enemy'Write use Object_Write; 
  48.  
  49.     procedure On_Collide( this : access Enemy; e : not null A_Entity ); 
  50.  
  51.     procedure Delete( this : in out A_Enemy ); 
  52.     pragma Postcondition( this = null ); 
  53.  
  54. end Entities.Enemies;