Advertisement
Mr-A

Quiz thingy

Jul 25th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.78 KB | None | 0 0
  1. void object::Update(background A_Field){
  2.      if (newframe){delayU=Frames[currframe].delay;newframe=false;}  
  3.      if (delayU==0){previousframe=currframe;currframe=Frames[currframe].nxt;newframe=true;}else{  //update frame and loop on the delay
  4.      delayU--;}
  5.    
  6.    
  7.    
  8.      if (previousframe!=4321 && Frames[currframe].loop_condition==previousframe && !doloop && Frames[currframe].loop_length!=0&&newframe){ //loop tag
  9.         U_loop_length= Frames[currframe].loop_length;
  10.         doloop=true;
  11.      }
  12.      if (Frames[currframe].loop_condition==previousframe && doloop&&newframe){
  13.         if (U_loop_length == 0){
  14.             previousframe=currframe;currframe=Frames[currframe].loop_goto;
  15.             doloop=false;newframe=true;
  16.         }else{
  17.         U_loop_length--;}
  18.      }
  19.      
  20.      
  21.      if(Frames[currframe].state==0&&total_fx!=0){ //apply friction
  22.         if (total_fx>0){
  23.             total_fx-=FRICTION;
  24.             if (total_fx<0) total_fx=0;
  25.         }else if (total_fx<0){
  26.             total_fx+=FRICTION;
  27.             if (total_fx>0) total_fx=0;
  28.         }
  29.      }
  30.      if (Frames[currframe].f_x!=0){           //f_x tag
  31.         if (Frames[currframe].f_x!=4321){
  32.             total_fx=Frames[currframe].f_x;
  33.         }else{total_fx=0;}
  34.      }
  35.      if (facing==0) {
  36.      Move(total_fx, 'x',A_Field);
  37.      }else{Move(-total_fx, 'x',A_Field);
  38.      }
  39.      
  40.      total_fx+=Frames[currframe].acc;   //acc tag
  41.      
  42.      if (P_UP==true){Move(-Frames[currframe].zhlddstnc, 'z', A_Field);}  //z_hold_distance tag
  43.      if (P_DOWN==true){Move(Frames[currframe].zhlddstnc, 'z', A_Field);}
  44.      
  45.      if (P_RIGHT==true){Move(Frames[currframe].xhlddstnc, 'x', A_Field);}  //x_hold_distance tag
  46.      if (P_LEFT==true){Move(-Frames[currframe].xhlddstnc, 'x', A_Field);}
  47.      
  48.      
  49.      
  50. //This is the part which deals with running (called dashing here):
  51.      if ((P_UP==true||P_DOWN==true||P_LEFT==true||P_RIGHT==true)&&Frames[currframe].state==0){
  52.         if (DASHR==1&&P_RIGHT==true&&facing==0){
  53.             previousframe=currframe;currframe=dashing;newframe=true;DASHR=0;DASHL=0;DshClksIntrvlL,DshClksIntrvlR=0;
  54.         }else if(DASHL==1&&P_LEFT==true&&facing==1){
  55.             previousframe=currframe;currframe=dashing;newframe=true;DASHL=0;DASHR=0;DshClksIntrvlL,DshClksIntrvlR=0;
  56.         }else{
  57.          previousframe=currframe;currframe=walking;newframe=true;}}
  58.         if(Frames[currframe].state==1 && !(P_UP==true||P_DOWN==true||P_LEFT==true||P_RIGHT==true)){
  59.         currframe=standing;newframe=true;previousframe=currframe;
  60.      }
  61.      
  62.      
  63.      
  64.      if (Frames[currframe].state==1){
  65.         if (P_UP==true){movedirz = 0;}
  66.         else if (P_DOWN==true){movedirz =1;}else movedirz = 2;
  67.         if (P_LEFT==true){movedirx = 1;}
  68.         else if (P_RIGHT==true){movedirx= 0;}else movedirx = 2;
  69.         Walk(movedirx, movedirz, A_Field);}
  70.        
  71.  
  72.      }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement