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