home *** CD-ROM | disk | FTP | other *** search
/ One Click 21 (Special) / OC021.iso / Juegos / 05-11-10-1.swf / scripts / __Packages / HitItem.as < prev    next >
Encoding:
Text File  |  2005-11-18  |  5.3 KB  |  169 lines

  1. class HitItem
  2. {
  3.    var nom = new String();
  4.    var hitType = new String();
  5.    var mcRef = null;
  6.    var mcEtat = null;
  7.    var missionId = new Number();
  8.    function HitItem(l_mcRef, l_type, l_missionId)
  9.    {
  10.       this.nom = l_mcRef._name;
  11.       this.mcRef = l_mcRef;
  12.       this.hitType = l_type;
  13.       this.mcEtat = "Idle";
  14.       this.mcRef.gotoAndStop("PasLa");
  15.       if(l_missionId != undefined)
  16.       {
  17.          this.missionId = l_missionId;
  18.       }
  19.       else
  20.       {
  21.          this.missionId = 1;
  22.       }
  23.       if(l_type != "fireBarrier")
  24.       {
  25.          this.mcRef._visible = false;
  26.          this.mcRef.gotoAndStop("PasLa");
  27.       }
  28.    }
  29.    function GetMissionId()
  30.    {
  31.       return this.missionId;
  32.    }
  33.    function CollisionHappen(l_collisionResp)
  34.    {
  35.       switch(this.hitType)
  36.       {
  37.          case "ob_hole":
  38.             l_collisionResp.Fall();
  39.             break;
  40.          case "burnInsigna":
  41.             if(this.mcEtat == "Idle")
  42.             {
  43.                var _loc3_ = _global.C[_global.C.G_vehPers].GetStageCoord();
  44.                if(this.mcRef.Etat.pu.hitTest(_loc3_.x,_loc3_.y,true))
  45.                {
  46.                   _global.S.PlaySound("powerUp",75,1);
  47.                   this.mcEtat = "Over";
  48.                   _global.C[_global.C.G_interface].ActivateBurnInsigna();
  49.                   this.mcRef.gotoAndStop("Over");
  50.                }
  51.             }
  52.             break;
  53.          case "deetsInsigna":
  54.             if(this.mcEtat == "Idle")
  55.             {
  56.                _loc3_ = _global.C[_global.C.G_vehPers].GetStageCoord();
  57.                if(this.mcRef.Etat.pu.hitTest(_loc3_.x,_loc3_.y,true))
  58.                {
  59.                   _global.S.PlaySound("powerUp",75,1);
  60.                   this.mcEtat = "Over";
  61.                   _global.C[_global.C.G_interface].ActivateDeetsInsigna();
  62.                   this.mcRef.gotoAndStop("Over");
  63.                }
  64.             }
  65.             break;
  66.          case "fizzInsigna":
  67.             if(this.mcEtat == "Idle")
  68.             {
  69.                _loc3_ = _global.C[_global.C.G_vehPers].GetStageCoord();
  70.                if(this.mcRef.Etat.pu.hitTest(_loc3_.x,_loc3_.y,true))
  71.                {
  72.                   _global.S.PlaySound("powerUp",75,1);
  73.                   this.mcEtat = "Over";
  74.                   _global.C[_global.C.G_interface].UpdatePoints(1000);
  75.                   _global.C._parent.Overlays.gotoAndPlay("1000Cred");
  76.                   this.mcRef.gotoAndStop("Over");
  77.                }
  78.             }
  79.             break;
  80.          case "edInsigna":
  81.             if(this.mcEtat == "Idle")
  82.             {
  83.                _loc3_ = _global.C[_global.C.G_vehPers].GetStageCoord();
  84.                if(this.mcRef.Etat.pu.hitTest(_loc3_.x,_loc3_.y,true))
  85.                {
  86.                   _global.S.PlaySound("powerUp",75,1);
  87.                   this.mcEtat = "Over";
  88.                   _global.C.G_nbLife = _global.C.G_nbLife + 1;
  89.                   _global.C[_global.C.G_interface].UpdateNbLife();
  90.                   _global.C[_global.C.G_interface].UpdateEdFace("Happy");
  91.                   this.mcRef.gotoAndStop("Over");
  92.                   _global.C._parent.Overlays.gotoAndPlay("1up");
  93.                }
  94.             }
  95.             break;
  96.          case "loogieInsigna":
  97.             if(this.mcEtat == "Idle")
  98.             {
  99.                _loc3_ = _global.C[_global.C.G_vehPers].GetStageCoord();
  100.                if(this.mcRef.Etat.pu.hitTest(_loc3_.x,_loc3_.y,true))
  101.                {
  102.                   _global.S.PlaySound("powerUp",75,1);
  103.                   this.mcEtat = "Over";
  104.                   _global.C[_global.C.G_interface].ActivateLoogieInsigna();
  105.                   this.mcRef.gotoAndStop("Over");
  106.                }
  107.             }
  108.             break;
  109.          case "powerSpike":
  110.             _global.C[_global.C.G_interface].ActivatePowerSpike();
  111.             this.mcRef.gotoAndStop("Over");
  112.             break;
  113.          case "gravityWell":
  114.             _global.C[_global.C.G_interface].ActivateGravityWell(this.mcRef);
  115.             this.mcRef.gotoAndStop("Over");
  116.             break;
  117.          case "fireBarrier":
  118.             if(!_global.C[_global.C.G_interface].IsBurnInsigna())
  119.             {
  120.                _global.C[_global.C.G_vehPers].CheckColliders(this.mcRef);
  121.                _global.S.PlaySound("fireBarrier",50,1);
  122.                this.mcRef.gotoAndStop("Hit");
  123.             }
  124.             break;
  125.          case "pk_drop":
  126.             this.OnDropZone(l_collisionResp);
  127.       }
  128.    }
  129.    function GetMcState()
  130.    {
  131.       return this.mcEtat;
  132.    }
  133.    function GetPropCoord()
  134.    {
  135.       var _loc2_ = new Object();
  136.       _loc2_.x = this.mcRef._x;
  137.       _loc2_.y = this.mcRef._y;
  138.       return _loc2_;
  139.    }
  140.    function GetZone()
  141.    {
  142.       var _loc3_ = this.GetPropCoord();
  143.       this.mcRef._parent.localToGlobal(_loc3_);
  144.       return _global.C.utils.GetHitZone(_loc3_);
  145.    }
  146.    function OnDropZone()
  147.    {
  148.    }
  149.    function SetMcState(l_state)
  150.    {
  151.       this.mcEtat = l_state;
  152.    }
  153.    function GotoMcState(l_state, l_visible)
  154.    {
  155.       if(this.hitType != "fireBarrier")
  156.       {
  157.          if(l_state == "PasLa")
  158.          {
  159.             this.mcRef.gotoAndStop(l_state);
  160.          }
  161.          else
  162.          {
  163.             this.mcRef.gotoAndStop(l_state);
  164.          }
  165.          this.mcRef._visible = l_visible;
  166.       }
  167.    }
  168. }
  169.