home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / flameout.swf / scripts / __Packages / Barrier.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  2.3 KB  |  82 lines

  1. class Barrier extends LRG.LRGMovieClip
  2. {
  3.    var m_bExplodable;
  4.    var m_fState;
  5.    var m_kCollision;
  6.    static var BS_NORMAL = 0;
  7.    static var BS_WEAKENED = 1;
  8.    static var BS_CRITICAL = 2;
  9.    static var BS_DESTROYED = 3;
  10.    static var BS_NOT_PRESENT = 4;
  11.    function Barrier()
  12.    {
  13.       super();
  14.    }
  15.    function init()
  16.    {
  17.       super.init();
  18.       this.setClock(_global.getGameTimer());
  19.       this.m_bExplodable = true;
  20.       this.m_fState = Barrier.BS_NORMAL;
  21.    }
  22.    function onStartRound()
  23.    {
  24.       this.setState(Math.floor(Math.random() * 5));
  25.       if(Settings(_global.getSettings()).getSetting("HIDE_BOUNDARIES"))
  26.       {
  27.          this.m_kCollision._visible = false;
  28.       }
  29.    }
  30.    function explode()
  31.    {
  32.       var _loc3_ = {x:this._x,y:this._y};
  33.       this._parent.localToGlobal(_loc3_);
  34.       var _loc4_ = _loc3_.x / 3 - 100;
  35.       _global.playSound("fma_obstacle_hit.wav",1,this,_loc4_);
  36.       switch(this.m_fState)
  37.       {
  38.          case Barrier.BS_NORMAL:
  39.             this.playAnimation("WEAKEND_EXPLOSION",40,11,30,false,1);
  40.             this.m_fState = Barrier.BS_WEAKENED;
  41.             break;
  42.          case Barrier.BS_WEAKENED:
  43.             this.playAnimation("CRITICAL_EXPLOSION",40,39,58,false,1);
  44.             this.m_fState = Barrier.BS_CRITICAL;
  45.             break;
  46.          case Barrier.BS_CRITICAL:
  47.             this.playAnimation("DESTROY_EXPLOSION",40,66,84,false,1);
  48.             this.m_fState = Barrier.BS_DESTROYED;
  49.             this.m_bExplodable = false;
  50.       }
  51.    }
  52.    function setState(fState)
  53.    {
  54.       var _loc0_ = null;
  55.       switch(this.m_fState = fState)
  56.       {
  57.          case Barrier.BS_NORMAL:
  58.             this.gotoAndStop("Normal");
  59.             this.m_bExplodable = true;
  60.             break;
  61.          case Barrier.BS_WEAKENED:
  62.             this.gotoAndStop("Weakened");
  63.             this.m_bExplodable = true;
  64.             break;
  65.          case Barrier.BS_CRITICAL:
  66.             this.gotoAndStop("Critical");
  67.             this.m_bExplodable = true;
  68.             break;
  69.          default:
  70.             this.gotoAndStop("NotPresent");
  71.             this.m_bExplodable = false;
  72.       }
  73.    }
  74.    function isExplodable()
  75.    {
  76.       return this.m_bExplodable;
  77.    }
  78.    function onActionCompleted(sActionKey)
  79.    {
  80.    }
  81. }
  82.