home *** CD-ROM | disk | FTP | other *** search
- package com.lofiminds.xwung
- {
- import com.lofiminds.gm.GameContext;
- import com.lofiminds.gm.GameObject;
- import com.lofiminds.gm.GameUtil;
- import com.lofiminds.gm.Instances;
-
- public class EnemyBase extends GameObject
- {
-
-
- public function EnemyBase()
- {
- super();
- }
-
- override public function destroy() : void
- {
- var _loc1_:Number = NaN;
- var _loc3_:int = 0;
- var _loc4_:int = 0;
- var _loc5_:GameObject = null;
- var _loc6_:Number = NaN;
- var _loc2_:Gameplay = Instances.getFirst(Gameplay) as Gameplay;
- if(!_loc2_.isRestart)
- {
- GameContext.app.playSound(Xwung.explodeSnd);
- _loc2_.giveScore(100,this);
- if(this.image_index == 1)
- {
- Instances.create(Bonus,x,y);
- }
- _loc4_ = int(GameUtil.randomRange(6,3));
- _loc1_ = Math.random() * Math.PI * 2;
- _loc3_ = 0;
- while(_loc3_ < _loc4_)
- {
- (_loc5_ = Instances.create(Explosion,x,y)).setSpeedAndDirection(4 + Math.random() * 12,_loc1_);
- _loc1_ += Math.PI * 2 / _loc4_;
- _loc3_++;
- }
- }
- _loc3_ = 0;
- while(_loc3_ < 8 + int(Math.random() * 5))
- {
- (_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));
- _loc5_.image_speed = 0.3 + Math.random() * 0.2;
- _loc3_++;
- }
- _loc1_ = image_angle + Math.PI / 4;
- _loc3_ = 0;
- while(_loc3_ < 4)
- {
- _loc5_ = Instances.create(Debris,x + GameUtil.lengthdir_x(11,_loc1_),y + GameUtil.lengthdir_y(11,_loc1_));
- _loc6_ = 4;
- if(_loc2_.level < 2)
- {
- _loc6_ = _loc2_.level + 2;
- }
- _loc5_.setSpeedAndDirection(_loc6_,_loc1_);
- _loc5_.image_angle = image_angle;
- _loc1_ += Math.PI * 0.5;
- _loc3_++;
- }
- }
- }
- }
-