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

  1.  
  2. #import "NXIGameBrain.h"
  3. #import "NXIPlayer.h"
  4. #import <stdio.h>
  5. #import <string.h>
  6.  
  7. @implementation NXIGameBrain
  8.  
  9. - makeGameInfo
  10. {    // This could be replaced by using the GameInfo palette.  I'm not using
  11.     // the palette yet since the GameInfo object may change, and then trying
  12.     // to load the .nib might crash until I add versioning in the read and
  13.     // write methods...
  14.     id info = [super makeGameInfo];
  15.  
  16.     // Set up for the sound in our game; 1 type with 3 sounds.
  17.     // 2 streams is enough to overlap the sounds a little without them
  18.     // getting too delayed.
  19.     [[[info setnumSoundTypes:1] setnumSoundStreams:2] setnumSounds:3];
  20.  
  21.     // Giving three bases to begin with.
  22.     [info setNumOneUps:3];
  23.  
  24.     // highscores:  only five per user on the network server:
  25.     [info setMaxScoresPerPlayerTable:0 net:YES to:5];
  26.     return info;
  27. }
  28.  
  29. - appDidInit:sender        // after init, but before 1st event.
  30. {    // Allocate the bonus tracker and a frame for the PlayerUpView
  31.     id xtraManTracker = [[BonusTracker alloc] init];
  32.     NXRect baseFrame = {{0, 0}, {BASE_WIDTH, BASE_HEIGHT}};
  33.     
  34.     [super appDidInit:sender];
  35.     
  36.     // set up bonus tracker for getting extra men
  37.     [xtraManTracker setBaseValue:10000];    // first xtra man at 10,000 pts.
  38.     [(BonusTracker *)xtraManTracker setIncrement:10000];
  39.                                         // next xtra every 15,000 pts...
  40.     // configure the PlayerUpView
  41.     [oneUpView setImage:[NXImage findImageNamed:"Base.tiff"]];
  42.     [oneUpView setImageFrame:&baseFrame];
  43.     [oneUpView setMargin:8.0];
  44.     [oneUpView setExtraManBonusTracker:xtraManTracker];    
  45.     return self;
  46. }
  47.  
  48. @end
  49.