home *** CD-ROM | disk | FTP | other *** search
- class Barrier extends LRG.LRGMovieClip
- {
- var m_bExplodable;
- var m_fState;
- var m_kCollision;
- static var BS_NORMAL = 0;
- static var BS_WEAKENED = 1;
- static var BS_CRITICAL = 2;
- static var BS_DESTROYED = 3;
- static var BS_NOT_PRESENT = 4;
- function Barrier()
- {
- super();
- }
- function init()
- {
- super.init();
- this.setClock(_global.getGameTimer());
- this.m_bExplodable = true;
- this.m_fState = Barrier.BS_NORMAL;
- }
- function onStartRound()
- {
- this.setState(Math.floor(Math.random() * 5));
- if(Settings(_global.getSettings()).getSetting("HIDE_BOUNDARIES"))
- {
- this.m_kCollision._visible = false;
- }
- }
- function explode()
- {
- var _loc3_ = {x:this._x,y:this._y};
- this._parent.localToGlobal(_loc3_);
- var _loc4_ = _loc3_.x / 3 - 100;
- _global.playSound("fma_obstacle_hit.wav",1,this,_loc4_);
- switch(this.m_fState)
- {
- case Barrier.BS_NORMAL:
- this.playAnimation("WEAKEND_EXPLOSION",40,11,30,false,1);
- this.m_fState = Barrier.BS_WEAKENED;
- break;
- case Barrier.BS_WEAKENED:
- this.playAnimation("CRITICAL_EXPLOSION",40,39,58,false,1);
- this.m_fState = Barrier.BS_CRITICAL;
- break;
- case Barrier.BS_CRITICAL:
- this.playAnimation("DESTROY_EXPLOSION",40,66,84,false,1);
- this.m_fState = Barrier.BS_DESTROYED;
- this.m_bExplodable = false;
- }
- }
- function setState(fState)
- {
- var _loc0_ = null;
- switch(this.m_fState = fState)
- {
- case Barrier.BS_NORMAL:
- this.gotoAndStop("Normal");
- this.m_bExplodable = true;
- break;
- case Barrier.BS_WEAKENED:
- this.gotoAndStop("Weakened");
- this.m_bExplodable = true;
- break;
- case Barrier.BS_CRITICAL:
- this.gotoAndStop("Critical");
- this.m_bExplodable = true;
- break;
- default:
- this.gotoAndStop("NotPresent");
- this.m_bExplodable = false;
- }
- }
- function isExplodable()
- {
- return this.m_bExplodable;
- }
- function onActionCompleted(sActionKey)
- {
- }
- }
-