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. private 
  24.  
  25.     type Enemy is abstract new Entity with 
  26.         record 
  27.             icon        : Integer := 0;        -- used by KEd 
  28.             deadlyTouch : Boolean := True;     -- is the enemy deadly to the player? 
  29.             shootable   : Boolean := True;     -- can the player's shots hit it? 
  30.         end record; 
  31.  
  32.     -- Raises an exception on error. 
  33.     procedure Construct( this     : access Enemy; 
  34.                          width, 
  35.                          height   : Natural; 
  36.                          libName  : String; 
  37.                          iconName : String ); 
  38.  
  39.     procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Enemy ); 
  40.     for Enemy'Read use Object_Read; 
  41.  
  42.     procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Enemy ); 
  43.     for Enemy'Write use Object_Write; 
  44.  
  45.     procedure On_Collide( this : access Enemy; e : not null A_Entity ); 
  46.  
  47.     procedure Delete( this : in out A_Enemy ); 
  48.     pragma Postcondition( this = null ); 
  49.  
  50. end Entities.Enemies;