home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / Obstacle.as < prev    next >
Encoding:
Text File  |  2010-04-12  |  951 b   |  29 lines

  1. class Obstacle
  2. {
  3.    var position;
  4.    var bOnScreen;
  5.    var bmpCanvas;
  6.    var bmpObstacle;
  7.    var width;
  8.    var screenPos;
  9.    function Obstacle(sLinkage, pos)
  10.    {
  11.       this.position = pos.clone();
  12.       this.bOnScreen = false;
  13.       this.bmpCanvas = Game.bmpDead;
  14.       this.bmpObstacle = flash.display.BitmapData.loadBitmap(sLinkage);
  15.       this.width = this.bmpObstacle.width;
  16.    }
  17.    function draw(leftEdge)
  18.    {
  19.       var _loc2_ = this.position.x - leftEdge - this.width / 2;
  20.       var _loc3_ = this.position.y + this.bmpObstacle.height;
  21.       this.screenPos = new flash.geom.Point(_loc2_,_loc3_);
  22.       if(_loc2_ > - this.bmpObstacle.width && _loc2_ < Game.screenW + this.bmpObstacle.width / 2)
  23.       {
  24.          this.bOnScreen = true;
  25.          this.bmpCanvas.copyPixels(this.bmpObstacle,this.bmpObstacle.rectangle,new flash.geom.Point(this.screenPos.x,Game.screenH - this.screenPos.y),null,null,true);
  26.       }
  27.    }
  28. }
  29.