home *** CD-ROM | disk | FTP | other *** search
/ AI Game Programming Wisdom / AIGameProgrammingWisdom.iso / SourceCode / 06 General Architectures / 04 Christian / ieapp.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-10  |  1.4 KB  |  66 lines

  1. // ieapp.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. #include "gametime.h"
  7. #include "dog.h"
  8. #include "cat.h"
  9. #include "world2d.h"
  10.  
  11.  
  12. int main(int argc, char* argv[])
  13. {
  14.     printf("\n\n*** Welcome to text town. ***\n\n");
  15.  
  16.     GameTime gameTime;
  17.  
  18.     World2D world ( 100, 100, 1.0f  );
  19.  
  20.     // seed randomness
  21.     srand ( (unsigned)time( NULL ) );
  22.  
  23.     // Dog 1
  24.     Dog dog1        ( "Butch" );
  25.     dog1.setWorld   ( &world, "Butch" );
  26.     dog1.setPos     ( 50, 50 );
  27.     dog1.initEnergy ( 2.0f, 10.0f );
  28.     dog1.setSpeeds  ( 0.5f, 8.0f );
  29.  
  30.     // Cat 1
  31.     Cat cat1        ( "Socks" );
  32.     cat1.setWorld   ( &world, "Socks" );
  33.     cat1.setPos     ( 45, 50 );
  34.     cat1.initEnergy ( 1.0f, 15.0f );
  35.     cat1.setSpeeds  ( 1.0f, 4.0f );
  36.  
  37.     // Dog 2
  38.     Dog dog2        ( "Speck" );
  39.     dog2.setWorld   ( &world, "Speck" );
  40.     dog2.setPos     ( 25, 25 );
  41.     dog2.initEnergy ( 1.5f, 13.0f );
  42.     dog2.setSpeeds  ( 0.8f, 9.0f );
  43.  
  44.     // Cat 2
  45.     Cat cat2        ( "Fluff" );
  46.     cat2.setWorld   ( &world, "Fluff" );
  47.     cat2.setPos     ( 60, 70 );
  48.     cat2.initEnergy ( 1.2f, 16.0f );
  49.     cat2.setSpeeds  ( 0.5f, 3.5f );
  50.  
  51.     while ( 1 )
  52.     {
  53.         gameTime.start();
  54.  
  55.         dog1.update();
  56.         cat1.update();
  57.         dog2.update();
  58.         cat2.update();
  59.  
  60.         gameTime.end();
  61.     }
  62.  
  63.     return 0;
  64. }
  65.  
  66.