home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
-
- [Embed(source="/_assets/assets.swf", symbol="BadArrow")]
- public class BadArrow extends MovieClip
- {
-
-
- public var arrowType:int;
-
- public var thrower:Monster;
-
- public var power:int;
-
- public var damageType:int;
-
- public var damage:int;
-
- public var direction:int;
-
- public var dy:Number;
-
- public var dx:Number;
-
- public var alive:Boolean;
-
- public var game:PlatformGame;
-
- public function BadArrow()
- {
- super();
- addFrameScript(0,frame1,1,frame2);
- }
-
- public function init(param1:Monster) : *
- {
- alive = true;
- arrowType = param1.monsterType;
- thrower = param1;
- switch(arrowType)
- {
- case 23:
- damage = 25;
- damageType = 1;
- dx = 0.3 * thrower.direction;
- dy = -0.05;
- x = thrower.x - 6 * thrower.direction;
- y = thrower.y - 36;
- scaleX = thrower.direction;
- power = 0.5;
- break;
- case 28:
- damage = 100;
- damageType = 4;
- gotoAndStop(2);
- power = 0.5;
- }
- }
-
- public function endTime(param1:Event) : *
- {
- deleteMe();
- }
-
- internal function frame1() : *
- {
- stop();
- }
-
- internal function frame2() : *
- {
- stop();
- }
-
- public function updateFlight(param1:*) : *
- {
- var _loc2_:int = 0;
- var _loc3_:* = undefined;
- if(arrowType == 23)
- {
- dy += param1 * 0.0002;
- }
- if(arrowType == 28)
- {
- _loc3_ = Math.atan(dy / dx);
- _loc3_ = 180 / Math.PI * _loc3_;
- rotation = _loc3_;
- if(rotation > 90 && dy < 0)
- {
- rotation -= 180;
- }
- if(dx < 0)
- {
- rotation -= 180;
- }
- }
- x += dx * param1;
- y += dy * param1;
- if(x > 700 || x < -20 || y > 500)
- {
- deleteMe();
- }
- if(game.hero.mc.hitTestPoint(x,y,true))
- {
- if(thrower.monsterType == 28)
- {
- game.sounds.wizardlaugh2.play();
- }
- game.hero.takeDamage(damage,damageType,power,x);
- deleteMe();
- }
- _loc2_ = 0;
- while(_loc2_ < game.fixedObjects.length)
- {
- if(game.fixedObjects[_loc2_].blocktype == 62 && !game.fixedObjects[_loc2_].open)
- {
- if(game.fixedObjects[_loc2_].block62.inner.hitTestPoint(x,y,false))
- {
- deleteMe();
- }
- }
- if(game.fixedObjects[_loc2_].blocktype == 63 && !game.fixedObjects[_loc2_].open)
- {
- if(game.fixedObjects[_loc2_].block63.inner.hitTestPoint(x,y,false))
- {
- deleteMe();
- }
- }
- _loc2_++;
- }
- }
-
- public function deleteMe() : *
- {
- game.removeBadArrow(this);
- }
- }
- }
-