Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClipEvent(load){
  2.         directionstate = 1;
  3.         flipflop1=0;
  4.         moveamount=0;
  5.     }
  6. onClipEvent(enterFrame){
  7.     tick1 = 0.2;
  8.         if(directionstate == 1){
  9.                 if(flipflop==0){
  10.                         moveamount += tick1;
  11.                         if(moveamount > 5){flipflop=1;}
  12.                     }
  13.                 if(flipflop==1){
  14.                         moveamount -= tick1;
  15.                         if(moveamount <= 0){flipflop=0;directionstate=2;}
  16.                     }
  17.             }
  18.         if(directionstate == 2){
  19.                 if(flipflop==0){
  20.                         moveamount -= tick1;
  21.                         if(moveamount < -5){flipflop=1;}
  22.                     }
  23.                 if(flipflop==1){
  24.                         moveamount += tick1;
  25.                         if(moveamount >= 0){flipflop=0;directionstate=2;}
  26.                     }
  27.             }
  28.         this._x += moveamount;
  29.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement