home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
- import flash.utils.*;
-
- [Embed(source="/_assets/assets.swf", symbol="Arrow")]
- public class Arrow extends MovieClip
- {
-
-
- public var isFlame:Boolean;
-
- public var inner:*;
-
- public var targ:MovieClip;
-
- public var damage:int;
-
- public var direction:int;
-
- public var dy:Number;
-
- public var fireFX:*;
-
- public var hit:Boolean;
-
- public var hitbit:*;
-
- public var dx:Number;
-
- public var game:PlatformGame;
-
- public function Arrow()
- {
- super();
- addFrameScript(0,frame1,1,frame2);
- damage = 25;
- }
-
- public function hitSomething() : *
- {
- var _loc1_:Timer = null;
- hit = true;
- _loc1_ = new Timer(750,1);
- _loc1_.start();
- _loc1_.addEventListener(TimerEvent.TIMER_COMPLETE,endTime);
- }
-
- public function endTime(param1:Event) : *
- {
- deleteMe();
- }
-
- internal function frame1() : *
- {
- stop();
- }
-
- internal function frame2() : *
- {
- stop();
- }
-
- public function updateFlight(param1:*) : *
- {
- var _loc2_:* = undefined;
- var _loc3_:int = 0;
- if(targ != null)
- {
- dx = targ.dx;
- dy = targ.dy;
- }
- x += dx * param1;
- y += dy * param1;
- _loc2_ = Math.atan(dy / dx);
- _loc2_ = 180 / Math.PI * _loc2_;
- if(targ == null)
- {
- rotation = _loc2_;
- }
- if(rotation > 90 && dy < 0)
- {
- rotation -= 180;
- }
- if(dx < 0 && dy > 0)
- {
- }
- if(x > 700 || x < -20 || y > 500)
- {
- deleteMe();
- }
- if(!hit)
- {
- _loc3_ = 0;
- while(_loc3_ < game.enemies.length)
- {
- if(game.enemies[_loc3_].monsterType != 28)
- {
- if(Boolean(game.enemies[_loc3_].inner.hitbithurt.hitTestObject(hitbit)) && Boolean(game.enemies[_loc3_].alive))
- {
- if(game.enemies[_loc3_].monsterType == 26)
- {
- if(!isFlame)
- {
- game.sounds.elementalimmune.play();
- deleteMe();
- break;
- }
- game.sounds.elementalhit.play();
- }
- game.enemies[_loc3_].takeDamage(damage);
- targ = game.enemies[_loc3_];
- hitSomething();
- }
- }
- else if(Boolean(game.enemies[_loc3_].inner.movewiz.hitbithurt.hitTestObject(hitbit)) && Boolean(game.enemies[_loc3_].alive))
- {
- game.sounds.wizardimmune.play();
- deleteMe();
- break;
- }
- _loc3_++;
- }
- _loc3_ = 0;
- while(_loc3_ < game.fixedObjects.length)
- {
- if(game.fixedObjects[_loc3_].blocktype == 62 && !game.fixedObjects[_loc3_].open)
- {
- if(game.fixedObjects[_loc3_].block62.inner.hitTestPoint(x,y,false))
- {
- targ = game.fixedObjects[_loc3_];
- hitSomething();
- }
- }
- if(game.fixedObjects[_loc3_].blocktype == 63 && !game.fixedObjects[_loc3_].open)
- {
- if(game.fixedObjects[_loc3_].block63.inner.hitTestPoint(x,y,false))
- {
- targ = game.fixedObjects[_loc3_];
- hitSomething();
- }
- }
- _loc3_++;
- }
- _loc3_ = 0;
- while(_loc3_ < game.lustras.length)
- {
- if(game.lustras[_loc3_].hitbithurt.hitTestObject(hitbit))
- {
- game.lustras[_loc3_].takeDamage(damage);
- deleteMe();
- }
- _loc3_++;
- }
- }
- }
-
- public function deleteMe() : *
- {
- game.removeArrow(this);
- }
- }
- }
-