home *** CD-ROM | disk | FTP | other *** search
- class GameBoostPad extends GenericObject
- {
- var right;
- var nearLeft;
- var nearRight;
- var farLeft;
- var farCenter;
- var farRight;
- var arrowTip;
- var world;
- var target;
- var collisionGroup = BB.ELEMENT;
- var collisionEnabled = true;
- var collisionSound = "SpeedBoost";
- var useRotation = false;
- var radius = 0;
- function GameBoostPad()
- {
- super();
- this.setObjectSound(this.collisionSound,_root);
- }
- function onCollision(obj)
- {
- this.playObjectSound();
- obj.currentSpeed = Math.min(obj.currentSpeed += 600,6000);
- obj.velocity.length += 1600;
- }
- function onAddToWorld()
- {
- this.radius = 50;
- var _loc3_ = this.right.x * this.sector.xScale * this.radius;
- var _loc2_ = this.right.y * this.sector.yScale * this.radius;
- this.nearLeft = new Vector(this.x - _loc3_,this.y - _loc2_,this.z);
- this.nearRight = new Vector(this.x + _loc3_,this.y + _loc2_,this.z);
- this.farLeft = new Vector(this.x - _loc3_ + this.sector.direction.x * this.radius,this.y - _loc2_ + this.sector.direction.y * this.radius,this.z + this.sector.direction.z * this.radius);
- this.farCenter = new Vector(this.x + this.sector.direction.x * this.radius,this.y + this.sector.direction.y * this.radius,this.z + this.sector.direction.z * this.radius);
- this.farRight = new Vector(this.x + _loc3_ + this.sector.direction.x * this.radius,this.y + _loc2_ + this.sector.direction.y * this.radius,this.z + this.sector.direction.z * this.radius);
- this.arrowTip = new Vector(this.x + this.sector.direction.x * this.radius * 2,this.y + this.sector.direction.y * this.radius * 2,this.z + this.sector.direction.z * this.radius * 2);
- this.radius = 100;
- }
- function setDisplay(offsetX, offsetY, offsetZ, depthRatio)
- {
- var _loc2_ = this.world.camera;
- var _loc3_ = _loc2_.depthFocus / (this.farRight.z - _loc2_.z);
- var _loc5_ = _loc2_.depthFocus / (this.arrowTip.z - _loc2_.z);
- this.target.clear();
- this.target.beginFill(16772608);
- this.target.lineStyle(0,15654144);
- this.target.moveTo((this.nearLeft.x - _loc2_.x) * depthRatio,(this.nearLeft.y - _loc2_.y) * depthRatio);
- this.target.lineTo((this.farCenter.x - _loc2_.x) * _loc3_,(this.farCenter.y - _loc2_.y) * _loc3_);
- this.target.lineTo((this.nearRight.x - _loc2_.x) * depthRatio,(this.nearRight.y - _loc2_.y) * depthRatio);
- this.target.lineTo((this.farRight.x - _loc2_.x) * _loc3_,(this.farRight.y - _loc2_.y) * _loc3_);
- this.target.lineTo((this.arrowTip.x - _loc2_.x) * _loc5_,(this.arrowTip.y - _loc2_.y) * _loc5_);
- this.target.lineTo((this.farLeft.x - _loc2_.x) * _loc3_,(this.farLeft.y - _loc2_.y) * _loc3_);
- this.target.lineTo((this.nearLeft.x - _loc2_.x) * depthRatio,(this.nearLeft.y - _loc2_.y) * depthRatio);
- this.target.endFill();
- }
- }
-