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

  1. package com.lofiminds.xwung
  2. {
  3.    import com.lofiminds.gm.GameObject;
  4.    import com.lofiminds.gm.GameUtil;
  5.    import com.lofiminds.gm.Instances;
  6.    
  7.    public class Explosion extends GameObject
  8.    {
  9.        
  10.       
  11.       private var dirAdd:Number;
  12.       
  13.       private var count:Number;
  14.       
  15.       public function Explosion()
  16.       {
  17.          super();
  18.          depth = 1;
  19.          dirAdd = GameUtil.degToRad(GameUtil.randomRange(0,25));
  20.          count = GameUtil.randomRange(10,5);
  21.       }
  22.       
  23.       override public function getClass() : Class
  24.       {
  25.          return Explosion;
  26.       }
  27.       
  28.       override public function update() : void
  29.       {
  30.          super.update();
  31.          if(count > 0)
  32.          {
  33.             --count;
  34.             setSpeedAndDirection(this.getSpeed(),getDirection() + dirAdd);
  35.             Instances.create(Blip,x,y);
  36.          }
  37.          else
  38.          {
  39.             Instances.destroy(this);
  40.          }
  41.       }
  42.    }
  43. }
  44.