Guest User

Untitled

a guest
Dec 12th, 2018
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. onClipEvent(load){ 
  2.     meon = 1
  3.     mespeed = 3;
  4.     turnspeed=5;
  5.     grav=0;
  6.     gravgo=.1
  7.     gravfi=.2
  8.     type=1;
  9. }
  10.  
  11. onClipEvent(enterFrame){
  12.    
  13.    
  14.         this._x += _root.xspeed;
  15.         this._y += _root.yspeed+grav;
  16.            
  17.         if(this._x > 900){this._x=-100;meon=1;this.gotoAndStop(type);}
  18.         if(this._x < -200){this._x=800;meon=1;this.gotoAndStop(type);}
  19.         if(this._y > 600){this._y=550;this._rotation+=180;meon=1;this.gotoAndStop(type);}
  20.        
  21.    
  22.    
  23.     if(meon == 1){
  24.            
  25.        
  26.         //SELF LOCATION
  27.         toploc = (_root.depth._y - this._y)*-1
  28.        
  29.        
  30.        
  31.        
  32.        
  33.         //PLAYER MOVE
  34.        
  35.         if(this._y < _root.water1._y){
  36.             grav = grav + gravgo
  37.             if(this._rotation>0){if(this._rotation < 180){this._rotation+=3}}
  38.             if(this._rotation<0){if(this._rotation > -180){this._rotation-=3}}
  39.             gravbool=1;
  40.         }else{
  41.             if(grav>gravfi){grav=grav-gravfi}
  42.             gravbool=0;
  43.         }
  44.        
  45.        
  46.    
  47.        
  48.        
  49.         this._x += (Math.cos((Math.PI*(this._rotation-90))/180) * mespeed);
  50.         this._y += (Math.sin((Math.PI*(this._rotation-90))/180) * mespeed);
  51.        
  52.        
  53.         trace(this._rotation);
  54.         myRadians = Math.atan2(this._y-_root.player._y, this._x-_root.player._x);
  55.         xleg = this._x - _root.player._x
  56.         yleg =this._y - _root.player._y
  57.         scared = Math.sqrt((xleg * xleg)+(yleg*yleg));
  58.        
  59.        
  60.         if (scared > (200)){
  61.             mespeed = 6;
  62.         }
  63.         if (scared < (300)){
  64.                
  65.                 if(gravbool==0){
  66.                     if(this._x > _root.player._x){
  67.                         myDegrees = Math.round((myRadians * 180/Math.PI));
  68.                         if(this._rotation-90 > (myDegrees)){this._rotation=this._rotation+turnspeed}
  69.                         if(this._rotation-90 < (myDegrees)){this._rotation=this._rotation-turnspeed}
  70.                     }else{
  71.                         myDegrees = Math.round((myRadians *180/Math.PI));
  72.                         if(this._rotation+90 > (myDegrees)){this._rotation=this._rotation-turnspeed}
  73.                         if(this._rotation+90 < (myDegrees)){this._rotation=this._rotation+turnspeed}
  74.                     }
  75.                 }
  76.                
  77.                
  78.                 mespeed = 6;
  79.                
  80.                
  81.                 _global.soundhum = (200 - scared)/2
  82.                 _global.soundpan = (_root.player._x - this._x)/2
  83.         }
  84.        
  85.         if (scared < (101)){
  86.             mespeed = 7;
  87.            
  88.         }
  89.        
  90.        
  91.        
  92.        
  93.         if (this.hotspot.hitTest(_root.player.hotspot)){
  94.             _global.soundhum = 0;
  95.             meon = 0;
  96.             this.gotoAndPlay('die');
  97.             break;
  98.         }
  99.        
  100.     }
  101. }
Add Comment
Please, Sign In to add comment