home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / starisland.swf / scripts / __Packages / illusoft / GameTile014.as < prev    next >
Encoding:
Text File  |  2007-12-10  |  2.2 KB  |  79 lines

  1. class illusoft.GameTile014 extends illusoft.GameTile
  2. {
  3.    var levelComplete;
  4.    var dmc;
  5.    var character;
  6.    var Enemy;
  7.    var lastTime = 0;
  8.    function GameTile014(id, dEngine, character, game, gamemc, nextLevel)
  9.    {
  10.       super(id,dEngine,character,game,gamemc,nextLevel);
  11.    }
  12.    function Update(x)
  13.    {
  14.       super.Update(x);
  15.       if(!this.levelComplete)
  16.       {
  17.          if(this.character.dmc.hitTest(this.dmc.b2.sou) && this.dmc.b2._visible || this.character.dmc.hitTest(this.dmc.b3.sou) && this.dmc.b3._visible || this.character.dmc.hitTest(this.dmc.b4.sou) && this.dmc.b4._visible || this.character.dmc.hitTest(this.dmc.b5.sou) && this.dmc.b5._visible)
  18.          {
  19.             _global.sounds.LoopSound("niao",100);
  20.          }
  21.          else
  22.          {
  23.             _global.sounds.FadeVolume("niao",false,false);
  24.          }
  25.       }
  26.       this.Reject();
  27.    }
  28.    function Reject()
  29.    {
  30.       var i = 1;
  31.       while(i < 13)
  32.       {
  33.          var temp = eval(this.dmc + ".mg" + i);
  34.          var nt = new Date().getTime();
  35.          if(this.character.dmc.hitTest(temp.myH))
  36.          {
  37.             temp.gotoAndPlay(2);
  38.             if(nt - this.lastTime > 200)
  39.             {
  40.                _global.sounds.PlaySound("boing3");
  41.                this.lastTime = nt;
  42.             }
  43.             this.character.ConstrainJump(15);
  44.          }
  45.          if(this.character.dmc.hitTest(temp))
  46.          {
  47.             if(Key.isDown(38) || Key.isDown(32))
  48.             {
  49.                if(nt - this.lastTime > 100)
  50.                {
  51.                   _global.sounds.PlaySound("jippie2");
  52.                   this.lastTime = nt;
  53.                }
  54.                this.character.ConstrainJump(40);
  55.             }
  56.          }
  57.          i++;
  58.       }
  59.    }
  60.    function Init()
  61.    {
  62.       super.Init();
  63.       _global.sounds.StartMusic("loop2");
  64.       this.Enemy = "b2/b3/b4/b5";
  65.       this.lastTime = new Date().getTime();
  66.       this.dmc.mg12 = this.dmc.mgN.mgin;
  67.    }
  68.    function Close()
  69.    {
  70.       _global.sounds.FadeVolume("niao",false,false);
  71.       super.Close();
  72.    }
  73.    function LevelComplete()
  74.    {
  75.       this.levelComplete = true;
  76.       _global.sounds.FadeVolume("niao",false,false);
  77.    }
  78. }
  79.