1. with Allegro.Bitmaps;                   use Allegro.Bitmaps; 
  2.  
  3. package Entities.Items is 
  4.  
  5.     type Item is abstract new Entity with private; 
  6.     type A_Item is access all Item'Class; 
  7.  
  8.     -- Returns a reference to a bitmap icon that represents the item. The 
  9.     -- returned reference is owned by the item. Do not modify it! 
  10.     function Get_Icon( this : access Item ) return A_Bitmap; 
  11.  
  12.     -- Gives the item's bonus to the player. Each item class gives a different 
  13.     -- bonus. This is called when a Player entity collides with the item. 
  14.     procedure Give_Item( this : access Item ) is abstract; 
  15.  
  16. private 
  17.  
  18.     type Item is abstract new Entity with 
  19.         record 
  20.             frameDelay : Time_Span := Time_Span_Zero; 
  21.             firstFrame : Natural := 0; 
  22.             maxFrames  : Positive := 1; 
  23.         end record; 
  24.  
  25.     procedure Construct( this       : access Item; 
  26.                          width, 
  27.                          height     : Natural; 
  28.                          libName    : String; 
  29.                          firstFrame : String; 
  30.                          maxFrames  : Positive; 
  31.                          frameDelay : Time_Span ); 
  32.  
  33.     -- Implements the entity On_Collide behavior to call Give_Item if the 
  34.     -- colliding entity is a player. 
  35.     procedure On_Collide( this : access Item; e : not null A_Entity ); 
  36.  
  37.     procedure Tick( this : access Item; upTime, dt : Time_Span ); 
  38.  
  39.     procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Item ); 
  40.     for Item'Read use Object_Read; 
  41.  
  42.     procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Item ); 
  43.     for Item'Write use Object_Write; 
  44.  
  45.     procedure Delete( this : in out A_Item ); 
  46.     pragma Postcondition( this = null ); 
  47.  
  48. end Entities.Items;