SHARE
TWEET

Untitled

a guest Dec 9th, 2018 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package  {
  2.     import flash.display.MovieClip;
  3.     import flash.events.Event;
  4.     import flash.display.Stage;
  5.     public class Mermi extends MovieClip{
  6.         private var radyan:Number;
  7.         public function Mermi(startX:Number,startY:Number,stageR:Stage) {
  8.             x=startX;
  9.             y=startY;
  10.             addEventListener(Event.ENTER_FRAME,step);
  11.             var dx:Number=stageR.mouseX-this.x;
  12.             var dy:Number=stageR.mouseY-this.y;
  13.             radyan=Math.atan2(dy,dx);
  14.             rotation=radyan*180/Math.PI;
  15.             }
  16.         private function step(e:Event):void{
  17.             x+=Math.cos(radyan)*15;
  18.             y+=Math.sin(radyan)*15;
  19.             if (this.x>stage.stageWidth || this.x<0 || this.y<0 || this.y>stage.stageHeight){
  20.                 this.parent.removeChild(this);
  21.                 removeEventListener(Event.ENTER_FRAME,step);
  22.             }
  23.         }
  24.     }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top