Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent(load){
- directionstate = 1;
- flipflop1=0;
- moveamount=0;
- }
- onClipEvent(enterFrame){
- tick1 = 0.2;
- if(directionstate == 1){
- if(flipflop==0){
- moveamount += tick1;
- if(moveamount > 5){flipflop=1;}
- }
- if(flipflop==1){
- moveamount -= tick1;
- if(moveamount == 0){flipflop=0;directionstate=2;}
- }
- }
- if(directionstate == 2){
- if(flipflop==0){
- moveamount -= tick1;
- if(moveamount < -5){flipflop=1;}
- }
- if(flipflop==1){
- moveamount += tick1;
- if(moveamount == 0){flipflop=0;directionstate=1;}
- }
- }
- this._x += moveamount;
- this.gear._rotation += moveamount;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement