1. package Entities.Players.Keen is 
  2.  
  3.     type Keen is new Player with private; 
  4.  
  5.     -- Checks if Keen can teleport and then queues the events needed to enter 
  6.     -- the teleport state. 
  7.     procedure Teleport( this         : access Keen; 
  8.                         fromX, fromY : Float; 
  9.                         toX,   toY   : Float ); 
  10.  
  11. private 
  12.  
  13.     type Action_Type is (Act_Moving, Act_Looking, Act_Looking_Back, 
  14.                          Act_Teleporting, Act_Idle, Act_Rising, Act_Dying); 
  15.  
  16.     type Keen is new Player with 
  17.         record 
  18.             -- *** these fields are streamed *** 
  19.  
  20.             -- true when keen is jumping (actively accelerating upward) 
  21.             jumping : Boolean := False; 
  22.  
  23.             -- the world y location of keen when he started his jump. this is 
  24.             -- used to determine when the jump has reached min and max heights. 
  25.             jumpStartY : Float := 0.0; 
  26.  
  27.             -- true if keen is on his pogo stick. note that jumping and grounded 
  28.             -- are independent states and may or may not be true. 
  29.             onPogo : Boolean := False; 
  30.  
  31.             -- true if keen is currently shooting. keen may shoot while 
  32.             -- performing certain actions. (ie: moving, hanging from a pole) 
  33.             shooting : Boolean := False; 
  34.  
  35.             -- the time when keen last fired a shot, used for keeping a delay 
  36.             -- between shots. (relative to .age) 
  37.             shootStart : Time_Span := Time_Span_Zero; 
  38.  
  39.             -- related to keen performing a one-shot action 
  40.             action         : Action_Type := Act_Moving; 
  41.             actionStart    : Time_Span := Time_Span_Zero;  -- (relative to .age) 
  42.             actionDuration : Time_Span := Time_Span_Zero; 
  43.  
  44.             idleStart  : Time_Span := Time_Span_Zero;      -- (relative to .age) 
  45.             idleNumber : Positive := 1;     -- number of the next idle animation 
  46.  
  47.             -- for the teleporting action 
  48.             teleportX,                                   -- teleport destination 
  49.             teleportY    : Float := 0.0;                 -- 
  50.             lastTeleport : Time_Span := Time_Span_Zero;  -- time of previous teleport (relative to .age) 
  51.  
  52.             deathX, 
  53.             deathY : Float := 0.0;      -- location of keen when he died 
  54.  
  55.             -- ** these fields do not need to be streamed ** 
  56.  
  57.             dead : Boolean := False;    -- dead fully dead? (temporary) 
  58.  
  59.             upTime : Time_Span := Time_Span_Zero; 
  60.  
  61.             attemptingJump : Boolean := False;  -- true when the jump key is being held down 
  62.             activating     : Boolean := False;  -- true if activate key being held 
  63.  
  64.             minJumpHeight,                  -- entity.player.keen.min_jump_height 
  65.             maxJumpHeight,                  -- entity.player.keen.max_jump_height 
  66.             minPogoHeight,                  -- entity.player.keen.min_pogo_height 
  67.             maxPogoHeight,                  -- entity.player.keen.max_pogo_height 
  68.             maxBounceHeight : Float := 0.0; -- entity.player.keen.max_bounce_height 
  69.             lookSpeed       : Float := 0.0; -- entity.player.keen.look_speed 
  70.         end record; 
  71.  
  72.     procedure Construct( this : access Keen ); 
  73.  
  74.     procedure Die( this : access Keen ); 
  75.  
  76.     procedure Face( this : access Keen; dir : Direction_Type ); 
  77.  
  78.     procedure Impulse( this : access Keen; name : Hashed_String ); 
  79.  
  80.     function Is_Busy( this : not null access Keen'Class ) return Boolean; 
  81.  
  82.     procedure Move_Start( this : access Keen; dir : Cardinal_Direction ); 
  83.  
  84.     procedure Move_Stop( this : access Keen; dir : Cardinal_Direction ); 
  85.  
  86.     function Object_Input( stream : access Root_Stream_Type'Class ) return Keen; 
  87.     for Keen'Input use Object_Input; 
  88.  
  89.     procedure Object_Read( stream : access Root_Stream_Type'Class; obj : out Keen ); 
  90.     for Keen'Read use Object_Read; 
  91.  
  92.     procedure Object_Write( stream : access Root_Stream_Type'Class; obj : Keen ); 
  93.     for Keen'Write use Object_Write; 
  94.  
  95.     procedure On_Hit_Wall( this : access Keen; dir : Cardinal_Direction ); 
  96.  
  97.     procedure Reset_Idle( this : not null access Keen'Class ); 
  98.  
  99.     procedure Shoot_Gun( this : not null access Keen'Class ); 
  100.  
  101.     procedure Start_Action( this   : not null access Keen'Class; 
  102.                             action : Action_Type; 
  103.                             length : Time_Span := Time_Span_Zero ); 
  104.  
  105.     procedure Start_Jump( this : not null access Keen'Class ); 
  106.  
  107.     procedure Stop_Jump( this : not null access Keen'Class ); 
  108.  
  109.     procedure Tick( this : access Keen; upTime, dt : Time_Span ); 
  110.  
  111.     procedure Update_Frame( this : access Keen; notify : Boolean := True ); 
  112.  
  113. end Entities.Players.Keen;