home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Zone / VRZONE.ISO / mac / PC / MISC3D / EEDEMO / TEST1.BOB < prev    next >
Text File  |  1993-08-11  |  1KB  |  55 lines

  1. // a Non-Object Oriented example.  It has to use Global variables for any
  2. // state information that needs to be saved between frames.
  3.  
  4. spinner()
  5. {
  6.         Rotate( 0, -15, 0 );
  7. }
  8.  
  9. c6spinner()
  10. {
  11.         Rotate( 0, 25, 0 );
  12.         if( c6Frames++ == 30 ) {
  13.                 DeleteTask( c6tsk );
  14.                 c6tsk = ScheduleTask(nil,"c6", "c6mover", 30);
  15.                 c6Frames = 0;
  16.         }
  17. }
  18. c6mover()
  19. {
  20.         if(c6Frames++ == 100) {
  21.                 DeleteTask( c6tsk );
  22.                 c6tsk = ScheduleTask(nil,"c6", "c6spinner", 30);
  23.                 c6x *= -1;
  24.                 c6Frames = 0;
  25.         }
  26.         Move( c6x, 0, 0 );
  27. }
  28.  
  29. moveit()
  30. {
  31.         if((nFrame % 30) == 0)
  32.                 dy *= -1;
  33.         if((nFrame++ % 20) == 0)
  34.                 dx *= -1;
  35.         Move( dx, dy, dz ); 
  36. }
  37.  
  38. main()
  39. {
  40.         dx = 160;
  41.         dy = 10; //move up
  42.         dz = 0;
  43.         nFrame = 0; //no of times moveit is called
  44.  
  45.         c6Frames = 0; //no of times c6 is activated
  46.         c6x = 50;
  47.  
  48.         ScheduleTask(0, "cone1", "moveit", 20);
  49.         ScheduleTask(0, "mh", "spinner", 30);
  50.  
  51.         //save the task handle so we can re-schedule it later
  52.         c6tsk = ScheduleTask(0,"c6", "c6spinner", 100);
  53. }
  54.  
  55.