All pastes #907445 Raw Edit

Something

public text v1 · immutable
·published 2008-02-17 16:41 UTC
rendered paste body
static-var moving, walking, aiming;

#define THIGH_F <-30>
#define THIGH_B <20>
#define THIGHSPEED_F <100>
#define THIGHSPEED_B <100>
#define SHIN_F <0>
#define SHIN_B <40>
#define SHINSPEED_F <160>
#define SHINSPEED_B <160>
#define torso <15>
#define torsoSPEED <100>
#define WALKBOB [2]
#define BOBSPEED [8]

Walk() {
   if(walking) return 0; //semaphore
   walking=1;

   turn leftlegtop to x-axis 0 now;
   turn leftlegbottom to x-axis 0 now;
   turn rightlegtop to x-axis <-10> now;
   turn rightlegbottom to x-axis <20> now;
   turn torso to z-axis torso now;
   while(moving) {
      if (moving) {
         turn rightlegtop to x-axis THIGH_F speed THIGHSPEED_F;
         turn rightlegbottom to x-axis SHIN_B speed SHINSPEED_B;
         wait-for-turn leftlegtop around x-axis;
      }
      if (moving) {
         turn leftlegtop to x-axis THIGH_B speed THIGHSPEED_B;
         turn torso to z-axis 0 - torso speed torsoSPEED;
         wait-for-turn rightlegbottom around x-axis;
      }
      if (moving) {
         turn rightlegbottom to x-axis SHIN_F speed SHINSPEED_F;
         wait-for-turn rightlegtop around x-axis;
      }
      if (moving) {
         turn rightlegtop to x-axis THIGH_B speed THIGHSPEED_B;
         turn torso to z-axis torso speed torsoSPEED;
         wait-for-turn leftlegtop around x-axis;
      }
      if (moving) {
         turn leftlegtop to x-axis THIGH_F speed THIGHSPEED_F;
         turn leftlegbottom to x-axis SHIN_B speed SHINSPEED_B;
         wait-for-turn leftlegbottom around x-axis;
      }
      if (moving) {
         turn leftlegbottom to x-axis SHIN_F speed SHINSPEED_F;
         wait-for-turn rightlegtop around x-axis;
      }
   }
   walking=0;
   turn rightlegtop to x-axis 0 speed THIGHSPEED_F;
   turn leftlegtop to x-axis 0 speed THIGHSPEED_F;
   turn rightlegbottom to x-axis 0 speed SHINSPEED_F;
   turn leftlegbottom to x-axis 0 speed SHINSPEED_F;
   turn torso to z-axis 0 speed torsoSPEED;
}