home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / xwung.swf / scripts / com / lofiminds / xwung / EnemyBase.as < prev    next >
Encoding:
Text File  |  2008-09-03  |  2.2 KB  |  68 lines

  1. package com.lofiminds.xwung
  2. {
  3.    import com.lofiminds.gm.GameContext;
  4.    import com.lofiminds.gm.GameObject;
  5.    import com.lofiminds.gm.GameUtil;
  6.    import com.lofiminds.gm.Instances;
  7.    
  8.    public class EnemyBase extends GameObject
  9.    {
  10.        
  11.       
  12.       public function EnemyBase()
  13.       {
  14.          super();
  15.       }
  16.       
  17.       override public function destroy() : void
  18.       {
  19.          var _loc1_:Number = NaN;
  20.          var _loc3_:int = 0;
  21.          var _loc4_:int = 0;
  22.          var _loc5_:GameObject = null;
  23.          var _loc6_:Number = NaN;
  24.          var _loc2_:Gameplay = Instances.getFirst(Gameplay) as Gameplay;
  25.          if(!_loc2_.isRestart)
  26.          {
  27.             GameContext.app.playSound(Xwung.explodeSnd);
  28.             _loc2_.giveScore(100,this);
  29.             if(this.image_index == 1)
  30.             {
  31.                Instances.create(Bonus,x,y);
  32.             }
  33.             _loc4_ = int(GameUtil.randomRange(6,3));
  34.             _loc1_ = Math.random() * Math.PI * 2;
  35.             _loc3_ = 0;
  36.             while(_loc3_ < _loc4_)
  37.             {
  38.                (_loc5_ = Instances.create(Explosion,x,y)).setSpeedAndDirection(4 + Math.random() * 12,_loc1_);
  39.                _loc1_ += Math.PI * 2 / _loc4_;
  40.                _loc3_++;
  41.             }
  42.          }
  43.          _loc3_ = 0;
  44.          while(_loc3_ < 8 + int(Math.random() * 5))
  45.          {
  46.             (_loc5_ = Instances.create(Blip,x + GameUtil.randomRange(0,20),y + GameUtil.randomRange(0,20))).setSpeedAndDirection(Math.random() * 8,GameUtil.point_direction(x,y,_loc5_.x,_loc5_.y));
  47.             _loc5_.image_speed = 0.3 + Math.random() * 0.2;
  48.             _loc3_++;
  49.          }
  50.          _loc1_ = image_angle + Math.PI / 4;
  51.          _loc3_ = 0;
  52.          while(_loc3_ < 4)
  53.          {
  54.             _loc5_ = Instances.create(Debris,x + GameUtil.lengthdir_x(11,_loc1_),y + GameUtil.lengthdir_y(11,_loc1_));
  55.             _loc6_ = 4;
  56.             if(_loc2_.level < 2)
  57.             {
  58.                _loc6_ = _loc2_.level + 2;
  59.             }
  60.             _loc5_.setSpeedAndDirection(_loc6_,_loc1_);
  61.             _loc5_.image_angle = image_angle;
  62.             _loc1_ += Math.PI * 0.5;
  63.             _loc3_++;
  64.          }
  65.       }
  66.    }
  67. }
  68.