home *** CD-ROM | disk | FTP | other *** search
- class Obstacle extends GenericObject
- {
- var linkageID;
- var target;
- var collisionSound = "obstacle";
- var collisionGroup = BB.OBSTACLE;
- var collisionEnabled = true;
- var disableAfterCollision = false;
- var radius = 25;
- var power = 500;
- var damageAmmount = 30;
- var destroyed = false;
- function Obstacle()
- {
- super();
- }
- function onAddToScene()
- {
- this.setObjectSound(this.collisionSound + ((this.collisionGroup & BB.SMALL) == 0 ? " tall" : " small"),_root);
- }
- function onRemoveFromScene()
- {
- }
- function toString()
- {
- return "Obstacle" + this.linkageID;
- }
- function destroy()
- {
- this.destroyed = true;
- this.collisionEnabled = false;
- this.removeFromScene();
- }
- function onCollision(obj)
- {
- if(obj.elevated && this.collisionGroup & BB.SMALL)
- {
- return undefined;
- }
- this.playObjectSound();
- obj.currentSpeed *= 0.9;
- var _loc3_ = (obj.x - this.x) / (this.radius + obj.radius);
- obj.velocity.x += obj.velocity.z * _loc3_;
- obj.velocity.z *= 0.5 - (1 - _loc3_);
- obj.takeDamage(this.damageAmmount);
- this.collisionEnabled = this.disableAfterCollision;
- this.target.gotoAndPlay("Collision");
- }
- }
-