home *** CD-ROM | disk | FTP | other *** search
- package
- {
- import flash.display.*;
- import flash.events.*;
- import flash.text.*;
-
- [Embed(source="/_assets/assets.swf", symbol="Lustra")]
- public class Lustra extends MovieClip
- {
-
-
- public var startX:Number;
-
- public var startY:Number;
-
- public var damageType:int;
-
- public var gravity:Number;
-
- public var blocktype:int;
-
- public var health:int;
-
- public var damage:int;
-
- public var falling:Boolean;
-
- public var dy:Number;
-
- public var hit:Boolean;
-
- public var hitbithurt:*;
-
- public var dx:Number;
-
- public var alive:Boolean;
-
- public var hitbitbite:*;
-
- public var game:PlatformGame;
-
- public function Lustra(param1:PlatformGame)
- {
- super();
- addFrameScript(73,frame74,87,frame88,312,frame313);
- game = param1;
- gravity = 0.03;
- damage = 101;
- damageType = 2;
- dy = 0;
- init();
- }
-
- internal function frame313() : *
- {
- regen();
- stop();
- }
-
- public function smash() : *
- {
- if(alive)
- {
- alive = false;
- gotoAndPlay("smash");
- }
- }
-
- public function init() : *
- {
- falling = false;
- hit = false;
- alive = true;
- dy = 0;
- health = 60;
- }
-
- internal function frame74() : *
- {
- stop();
- }
-
- internal function frame88() : *
- {
- checkDead();
- gotoAndStop("start");
- }
-
- public function regen() : *
- {
- gotoAndPlay(1);
- x = startX;
- y = startY;
- init();
- }
-
- public function fall() : *
- {
- falling = true;
- }
-
- public function checkDead() : *
- {
- if(health == 0)
- {
- fall();
- }
- }
-
- public function update(param1:Number) : *
- {
- var _loc2_:int = 0;
- var _loc3_:* = undefined;
- if(falling)
- {
- if(!hit)
- {
- dy += gravity * param1;
- }
- y += dy;
- }
- if(falling)
- {
- _loc2_ = 0;
- while(_loc2_ < game.enemies.length)
- {
- if(game.enemies[_loc2_].monsterType != 28)
- {
- if(Boolean(game.enemies[_loc2_].inner.hitbithurt.hitTestObject(hitbitbite)) && Boolean(game.enemies[_loc2_].alive))
- {
- if(!hit)
- {
- game.enemies[_loc2_].takeDamage(damage);
- }
- smash();
- hit = true;
- break;
- }
- }
- else if(Boolean(game.enemies[_loc2_].inner.movewiz.hitbithurt.hitTestObject(hitbitbite)) && Boolean(game.enemies[_loc2_].alive))
- {
- if(!hit)
- {
- game.sounds.wizardhit.play();
- game.enemies[_loc2_].takeDamage(damage);
- }
- hit = true;
- smash();
- break;
- }
- _loc2_++;
- }
- if(!hit && game.hero.alive && game.hero.mc.hitTestObject(hitbitbite))
- {
- game.hero.takeDamage(damage,damageType,0,x);
- hit = true;
- smash();
- }
- _loc2_ = 0;
- while(_loc2_ < game.fixedObjects.length)
- {
- _loc3_ = game.fixedObjects[_loc2_];
- if(_loc3_.blocktype < 11)
- {
- if(x + 80 > _loc3_.leftside && x < _loc3_.rightside)
- {
- if(y + 85 > _loc3_.topside)
- {
- hit = true;
- y = _loc3_.topside - 85;
- dy = 0;
- smash();
- break;
- }
- }
- }
- _loc2_++;
- }
- if(x > 700 || x < -20 || y > 440 - height)
- {
- hit = true;
- dy = 0;
- smash();
- }
- }
- }
-
- public function takeDamage(param1:*) : *
- {
- if(!hit)
- {
- health -= param1;
- if(health < 0)
- {
- health = 0;
- }
- gotoAndPlay("hit");
- }
- }
- }
- }
-