home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / GameKit / Examples / NX_Invaders / NXIAlienOverseer.h < prev    next >
Encoding:
Text File  |  1994-06-07  |  1.2 KB  |  43 lines

  1.  
  2. // This object moves and renders the marching aliens.  It is an "invisible"
  3. // GKActor -- it is never rendered, yet is part of the action machinery
  4. // since it imposes control on top of the NXIAliens, which consent to the
  5. // master control of this object.
  6.  
  7. #import <gamekit/gamekit.h>
  8.  
  9. // alien movement in steps.
  10. #define TOP_ALIEN_ROW    (4 + ALIEN_HEIGHT)
  11. #define ALIEN_VERTICAL_STEP_SIZE    (4 + ALIEN_HEIGHT)
  12. #define ALIEN_HORIZONTAL_STEP_SIZE    2
  13. // these next two should be equal in magnitude always!
  14. #define ALIEN_RIGHT    ALIEN_HORIZONTAL_STEP_SIZE
  15. #define ALIEN_LEFT    (-1 * ALIEN_HORIZONTAL_STEP_SIZE)
  16.  
  17. #define ALIEN_STEPCYCLES    5
  18.  
  19. #define ALIEN_NUMROWS    5
  20. #define ALIEN_NUMVADERS    11
  21.  
  22. #define LEFT_EDGE 0
  23. #define RIGHT_EDGE 1
  24.  
  25. @interface NXIAlienOverseer:GKActor
  26. {
  27.     NXPoint movementDirection, lastMovementDirection, movement;
  28.     int moveCycles;
  29.     id leftMost, rightMost, invaderList;
  30. }
  31.  
  32. + new;
  33. - init;
  34. - setUpAliensForLevel:(int)aLevel;    // called at the start of a level
  35. - findRightMost;
  36. - findLeftMost;
  37. - alienLeavingTheStage:anAlien;
  38. - move:sender;    // decide how to move the aliens for the next frame
  39. - movementVector:(NXPoint *)aVector; // return by reference which way an
  40.     // alien invader should move this frame.
  41.  
  42. @end
  43.