home *** CD-ROM | disk | FTP | other *** search
/ Ice Age Fan CD 1 / CD1_Scrat.iso / flash / data / game.swf / scripts / asCode / visualBubble.as < prev   
Encoding:
Text File  |  2012-07-04  |  2.1 KB  |  101 lines

  1. package asCode
  2. {
  3.    import flash.geom.Point;
  4.    
  5.    public class visualBubble
  6.    {
  7.       private static var remove:Boolean;
  8.       
  9.       private static var ENEMY_METEOR:int = 1;
  10.       
  11.       private static var ENEMY_BEE:int = 2;
  12.       
  13.       private static var ENEMY_STICK:int = 3;
  14.       
  15.       private var life:int;
  16.       
  17.       private var hitTestRadius:int = 30;
  18.       
  19.       private var id:int;
  20.       
  21.       private var enemyType:int;
  22.       
  23.       private var scale:Number;
  24.       
  25.       private var speed:Number;
  26.       
  27.       private var xVel:Number = 0;
  28.       
  29.       private var yVel:Number = 0;
  30.       
  31.       private var dir:Number = 0;
  32.       
  33.       private var radians:Number = 0;
  34.       
  35.       private var loc:Point;
  36.       
  37.       public function visualBubble(param1:Number, param2:Number, param3:Number)
  38.       {
  39.          super();
  40.          loc = new Point(param1,param2);
  41.          dir = param3 + Math.random() * 10 - 5;
  42.          speed = Math.random() * 20 + 5;
  43.          radians = dir / 180 * Math.PI;
  44.          scale = Math.random() + 0.75;
  45.          remove = false;
  46.          life = 30;
  47.       }
  48.       
  49.       public function getLife() : int
  50.       {
  51.          return life;
  52.       }
  53.       
  54.       public function getScale() : Number
  55.       {
  56.          return scale;
  57.       }
  58.       
  59.       public function getType() : int
  60.       {
  61.          return enemyType;
  62.       }
  63.       
  64.       public function manageVisualBubble() : void
  65.       {
  66.          --life;
  67.          speed *= 0.9;
  68.          xVel = Math.cos(radians) * speed;
  69.          yVel = Math.sin(radians) * speed;
  70.          loc.x += xVel;
  71.          loc.y += yVel;
  72.       }
  73.       
  74.       public function getHitRadius() : Number
  75.       {
  76.          return hitTestRadius;
  77.       }
  78.       
  79.       public function getDir() : Number
  80.       {
  81.          return dir;
  82.       }
  83.       
  84.       public function getID() : int
  85.       {
  86.          return id;
  87.       }
  88.       
  89.       public function getRemove() : Boolean
  90.       {
  91.          return remove;
  92.       }
  93.       
  94.       public function getLoc() : Point
  95.       {
  96.          return new Point(loc.x,loc.y);
  97.       }
  98.    }
  99. }
  100.  
  101.