home *** CD-ROM | disk | FTP | other *** search
- package RES.OBJECTS
- {
- import ENGINE.CORE.OUtils;
- import ENGINE.DISPLAY.OSprite;
- import flash.events.Event;
- import flash.geom.Point;
-
- public class OBang extends OSprite
- {
-
- public static const iMaxBubbles:int = 15;
-
-
- public function OBang()
- {
- super();
- }
-
- public function Clear() : void
- {
- super.Free();
- }
-
- public function MakeFirework0() : void
- {
- var _loc1_:OBubble = null;
- _loc1_ = OBubble.MakeFireworkBubble(OUtils.Random(4,7),OUtils.Random(18,20),OUtils.Random(0.08,0.1),0,Math.round(Math.random() * 5),400,600,OUtils.Random(-2.5,2.5),OUtils.Random(-3.5,-2));
- _loc1_.prType = 0;
- this.addChild(_loc1_);
- }
-
- public function MakeFirework2(param1:OBubble) : void
- {
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- var _loc4_:Point = null;
- var _loc5_:Point = null;
- var _loc6_:Number = NaN;
- var _loc7_:Number = NaN;
- var _loc8_:OBubble = null;
- _loc2_ = OUtils.Random(2,4);
- _loc3_ = 0;
- while(_loc3_ < _loc2_)
- {
- if(this.numChildren >= OBang.iMaxBubbles)
- {
- return;
- }
- (_loc4_ = Point.polar(Math.random() * param1.prRadius,Math.random() * Math.PI * 2)).offset(param1.prX,param1.prY);
- _loc5_ = Point.polar(OUtils.Random(2,3),Math.random() * Math.PI * 2);
- if((_loc6_ = OUtils.Random(param1.prRadius / 3,param1.prRadius / 2)) < 4)
- {
- _loc6_ = 4;
- }
- else if(_loc6_ > 10)
- {
- _loc6_ = 10;
- }
- _loc7_ = OUtils.Random(-0.2,-0.1);
- (_loc8_ = OBubble.MakeFireworkBubble(_loc6_ * 2,_loc6_,_loc7_,_loc7_ / _loc6_ * 0.5,Math.round(Math.random() * 5),_loc4_.x,_loc4_.y,_loc5_.x,_loc5_.y)).prType = 2;
- this.addChild(_loc8_);
- _loc3_++;
- }
- }
-
- public function MakeFirework1(param1:OBubble) : void
- {
- var _loc2_:int = 0;
- var _loc3_:int = 0;
- var _loc4_:Point = null;
- var _loc5_:Point = null;
- var _loc6_:Number = NaN;
- var _loc7_:OBubble = null;
- _loc2_ = OUtils.Random(3,5);
- _loc3_ = 0;
- while(_loc3_ < _loc2_)
- {
- if(this.numChildren >= OBang.iMaxBubbles)
- {
- return;
- }
- (_loc4_ = Point.polar(Math.random() * param1.prRadius,Math.random() * Math.PI * 2)).offset(param1.prX,param1.prY);
- _loc5_ = Point.polar(OUtils.Random(3,4),Math.random() * Math.PI * 2);
- if((_loc6_ = OUtils.Random(param1.prRadius / 4 * 3,param1.prRadius)) < 4)
- {
- _loc6_ = 4;
- }
- else if(_loc6_ > 10)
- {
- _loc6_ = 10;
- }
- (_loc7_ = OBubble.MakeFireworkBubble(_loc6_,_loc6_ * 2,OUtils.Random(0.1,0.2),0,Math.round(Math.random() * 5),_loc4_.x,_loc4_.y,_loc5_.x,_loc5_.y)).prType = 1;
- this.addChild(_loc7_);
- _loc3_++;
- }
- }
-
- public function MakeFirework3(param1:OBubble, param2:int) : void
- {
- var _loc3_:int = 0;
- var _loc4_:int = 0;
- var _loc5_:OSprite = null;
- var _loc6_:Point = null;
- var _loc7_:Point = null;
- var _loc8_:Number = NaN;
- var _loc9_:Number = NaN;
- var _loc10_:OBubble = null;
- _loc3_ = param2 == 4 ? int(OUtils.Random(1,2)) : int(OUtils.Random(2,4));
- _loc4_ = 0;
- while(_loc4_ < _loc3_)
- {
- if(this.numChildren >= OBang.iMaxBubbles)
- {
- return;
- }
- _loc5_ = param1.parent as OSprite;
- (_loc6_ = Point.polar(Math.random() * param1.prRadius,Math.random() * Math.PI * 2)).offset(param1.prX + _loc5_.prX,param1.prY + _loc5_.prY);
- _loc7_ = Point.polar(OUtils.Random(1.5,2),Math.random() * Math.PI * 2);
- if((_loc8_ = OUtils.Random(param1.prRadius / 3,OUtils.Random(2,4))) < 4)
- {
- _loc8_ = 4;
- }
- else if(_loc8_ > 10)
- {
- _loc8_ = 10;
- }
- _loc9_ = OUtils.Random(-0.3,-0.1);
- (_loc10_ = OBubble.MakeFireworkBubble(_loc8_ * 2,_loc8_,_loc9_,_loc9_ / _loc8_ * 0.5,param1.prCInd,_loc6_.x,_loc6_.y,_loc7_.x,_loc7_.y)).prType = param2;
- this.addChild(_loc10_);
- _loc4_++;
- }
- }
-
- override public function Free() : void
- {
- this.removeEventListener(Event.ENTER_FRAME,OnEnterFrame);
- super.Free();
- }
-
- public function OnEnterFrame(param1:Event) : void
- {
- var _loc2_:int = 0;
- var _loc3_:OBubble = null;
- _loc2_ = 0;
- while(_loc2_ < this.numChildren)
- {
- _loc3_ = this.getChildAt(_loc2_) as OBubble;
- _loc3_.OnEnterFrame(param1);
- if(_loc3_.State == OBubble.stBang)
- {
- switch(_loc3_.prType)
- {
- case 0:
- MakeFirework1(_loc3_);
- break;
- case 1:
- MakeFirework2(_loc3_);
- break;
- case 2:
- break;
- case 3:
- MakeFirework3(_loc3_,4);
- }
- this.removeChild(_loc3_);
- _loc3_.Free();
- }
- else
- {
- _loc2_++;
- }
- }
- }
- }
- }
-