-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bose1.as
executable file
·119 lines (118 loc) · 3.53 KB
/
Bose1.as
1
package { import flash.display.MovieClip; import flash.text.TextField; import flash.display.*; import flash.events.*; import flash.utils.Timer; import bar_mc; import GameClass; import flash.utils.getDefinitionByName; import flash.display.BitmapData; import flash.geom.ColorTransform; import flash.geom.Matrix; import flash.geom.Rectangle; import Comman; class Bose1 extends Comman { public var _in_area:Boolean; public var speed:Number; var numDoors:Number; var color:String; public var bar:bar_mc; public var press:Boolean; public var per:Number; public var reduceVal:Number; public var _reduceVal:Number; public var _type:Number; private var _b:Number; public var shootVal:Number; public var shoot:Boolean; public var removed:Boolean; private var shipArray:Array; private var timer:Timer; private var ymov:Number; private var startShooting_val:Boolean; public function Bose1() { ymov = 30; shoot = false; startShooting_val = true; speed = 1; _b = 0; _in_area = false; removed = false; _reduceVal = 0.1; reduceVal = 1; _type = 0; shootVal = 0.5; per = 100; bar = new bar_mc(); bar.name = "bar_mc"; var holder_mc:MovieClip = this.getChildByName("holder_mc") as MovieClip; bar.x = holder_mc.x; bar.y = holder_mc.y; this.addChild(bar); this.mouseChildren = false; this.press = false; timer = new Timer(100,4); timer.addEventListener( TimerEvent.TIMER, doit_timer); this.addEventListener(Event.ADDED_TO_STAGE,parent_); } override public function parent_(e:Event):void { mainClass = (this.root as MovieClip); var mc:MovieClip = mainClass.main_mc.holder_mc.getChildByName("ship_mc"); shipArray = new Array(mc); super.parent_(e); } public function doit_timer(e:TimerEvent):void { shoot = true; } override public function loopUntilRemoved(e:Event):void{ if (!mainClass.main_mc.gamePause) { e.target.y += (Math.sin(ymov/20)*4); ymov+=1; //trace(mainClass.main_mc.bulletholder_mc+" : mainClass :"+shipArray+" : "); if (mainClass!=null) { var bar_mc:MovieClip = e.target.getChildByName("bar_mc") as MovieClip; bar_mc.gotoAndStop(Math.floor ((bar_mc.totalFrames * per) / 100)); point((e.target as MovieClip),shipArray[0] as MovieClip); if (e.target.shoot) { e.target._b++; if (e.target._b%7==0) { shootFire((e.target as MovieClip),shipArray,mainClass.main_mc.bulletholder_mc,e.target._b,1); } } if (per<=1 && !removed) { per = 1; removed = true; this.removeEventListener(Event.ENTER_FRAME , doit); mainClass.main_mc.doit(this); } if (this._in_area && startShooting_val) { startShooting_val = false; timer.start(); } } } } public function shootFire(clip_mc:MovieClip, clipar:Array, attach:MovieClip, j:Number, dspeed:Number) { var mainClass = (this.root as MovieClip); for (var count:Number=1; count<=1; count++) { var stack_:stack_e = new stack_e(); var mc:MovieClip = attach.addChild (stack_) as MovieClip; mc.name = "stack" + j +""+count+ "_mc"; var point_mc:MovieClip = clip_mc.getChildByName("point"+count+"_mc") as MovieClip; mc.rotation = point_mc.rotation - 90; //trace(point_mc.name+" : point_mc"); mc.x = point_mc.x+clip_mc.x; mc.y = point_mc.y+clip_mc.y; mc.scale = 100; mc.temp = 15; mc.hit = true; mc.speed = 10; mc.shootVal = shootVal; mc.clipar = clipar; mc.isUser = false; point_mc.rotation = point(clip_mc,clipar[0]); } } }}