home *** CD-ROM | disk | FTP | other *** search
- class Obstacle
- {
- var position;
- var bOnScreen;
- var bmpCanvas;
- var bmpObstacle;
- var width;
- var screenPos;
- function Obstacle(sLinkage, pos)
- {
- this.position = pos.clone();
- this.bOnScreen = false;
- this.bmpCanvas = Game.bmpDead;
- this.bmpObstacle = flash.display.BitmapData.loadBitmap(sLinkage);
- this.width = this.bmpObstacle.width;
- }
- function draw(leftEdge)
- {
- var _loc2_ = this.position.x - leftEdge - this.width / 2;
- var _loc3_ = this.position.y + this.bmpObstacle.height;
- this.screenPos = new flash.geom.Point(_loc2_,_loc3_);
- if(_loc2_ > - this.bmpObstacle.width && _loc2_ < Game.screenW + this.bmpObstacle.width / 2)
- {
- this.bOnScreen = true;
- this.bmpCanvas.copyPixels(this.bmpObstacle,this.bmpObstacle.rectangle,new flash.geom.Point(this.screenPos.x,Game.screenH - this.screenPos.y),null,null,true);
- }
- }
- }
-