Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onClipEvent(load){
- meon = 1
- mespeed = 3;
- turnspeed=5;
- grav=0;
- gravgo=.1
- gravfi=.2
- type=1;
- }
- onClipEvent(enterFrame){
- this._x += _root.xspeed;
- this._y += _root.yspeed+grav;
- if(this._x > 900){this._x=-100;meon=1;this.gotoAndStop(type);}
- if(this._x < -200){this._x=800;meon=1;this.gotoAndStop(type);}
- if(this._y > 600){this._y=550;this._rotation+=180;meon=1;this.gotoAndStop(type);}
- if(meon == 1){
- //SELF LOCATION
- toploc = (_root.depth._y - this._y)*-1
- //PLAYER MOVE
- if(this._y < _root.water1._y){
- grav = grav + gravgo
- if(this._rotation>0){if(this._rotation < 180){this._rotation+=3}}
- if(this._rotation<0){if(this._rotation > -180){this._rotation-=3}}
- gravbool=1;
- }else{
- if(grav>gravfi){grav=grav-gravfi}
- gravbool=0;
- }
- this._x += (Math.cos((Math.PI*(this._rotation-90))/180) * mespeed);
- this._y += (Math.sin((Math.PI*(this._rotation-90))/180) * mespeed);
- trace(this._rotation);
- myRadians = Math.atan2(this._y-_root.player._y, this._x-_root.player._x);
- xleg = this._x - _root.player._x
- yleg =this._y - _root.player._y
- scared = Math.sqrt((xleg * xleg)+(yleg*yleg));
- if (scared > (200)){
- mespeed = 6;
- }
- if (scared < (300)){
- if(gravbool==0){
- if(this._x > _root.player._x){
- myDegrees = Math.round((myRadians * 180/Math.PI));
- if(this._rotation-90 > (myDegrees)){this._rotation=this._rotation+turnspeed}
- if(this._rotation-90 < (myDegrees)){this._rotation=this._rotation-turnspeed}
- }else{
- myDegrees = Math.round((myRadians *180/Math.PI));
- if(this._rotation+90 > (myDegrees)){this._rotation=this._rotation-turnspeed}
- if(this._rotation+90 < (myDegrees)){this._rotation=this._rotation+turnspeed}
- }
- }
- mespeed = 6;
- _global.soundhum = (200 - scared)/2
- _global.soundpan = (_root.player._x - this._x)/2
- }
- if (scared < (101)){
- mespeed = 7;
- }
- if (this.hotspot.hitTest(_root.player.hotspot)){
- _global.soundhum = 0;
- meon = 0;
- this.gotoAndPlay('die');
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment