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

  1. class illusoft.GameTile015 extends illusoft.GameTile
  2. {
  3.    var lastTime;
  4.    var character;
  5.    var dmc;
  6.    var Enemy;
  7.    var gameMC;
  8.    var surfaces;
  9.    var dynamicsEngine;
  10.    var levelComplete;
  11.    var aniDone = false;
  12.    var Hit2 = false;
  13.    function GameTile015(id, dEngine, character, game, gamemc, nextLevel)
  14.    {
  15.       super(id,dEngine,character,game,gamemc,nextLevel);
  16.       this.lastTime = new Date().getTime();
  17.    }
  18.    function Update(x)
  19.    {
  20.       super.Update(x);
  21.       var _loc5_ = this.character.dmc;
  22.       var _loc4_ = new Date().getTime();
  23.       if(_loc5_.hitTest(this.dmc.myHitter1))
  24.       {
  25.          trace("myHitter1");
  26.          this.dmc.myHitter1._y = -100;
  27.          this.dmc.mole_go1.play();
  28.       }
  29.       if(_loc5_.hitTest(this.dmc.myHitter2))
  30.       {
  31.          trace("myHitter2");
  32.          this.dmc.myHitter2._y = -100;
  33.          this.dmc.mole_go2.play();
  34.       }
  35.       if(this.Hit2 && _loc5_.hitTest(this.dmc.myHitter3))
  36.       {
  37.          trace("myHitter3");
  38.          this.dmc.myHitter3._y = -100;
  39.          this.dmc.mole_go4.play();
  40.       }
  41.       if(_loc5_.hitTest(this.dmc.bomb1))
  42.       {
  43.          this.dmc.bomb1.play();
  44.          if(_loc4_ - this.lastTime > 500)
  45.          {
  46.             _global.sounds.PlaySound("explode");
  47.             this.lastTime = _loc4_;
  48.          }
  49.          this.character.MoveUp(8);
  50.       }
  51.       else if(_loc5_.hitTest(this.dmc.bomb2))
  52.       {
  53.          this.dmc.bomb2.play();
  54.          this.character.MoveUp(16);
  55.          if(_loc4_ - this.lastTime > 500)
  56.          {
  57.             _global.sounds.PlaySound("explode");
  58.             this.lastTime = _loc4_;
  59.          }
  60.       }
  61.       else if(_loc5_.hitTest(this.dmc.bomb4))
  62.       {
  63.          this.dmc.bomb4.play();
  64.          this.character.MoveUp(12);
  65.          if(_loc4_ - this.lastTime > 500)
  66.          {
  67.             _global.sounds.PlaySound("explode");
  68.             this.lastTime = _loc4_;
  69.          }
  70.       }
  71.       else if(_loc5_.hitTest(this.dmc.button1))
  72.       {
  73.          this.character.MoveUp(22);
  74.          if(_loc4_ - this.lastTime > 500)
  75.          {
  76.             _global.sounds.PlaySound("boing");
  77.             this.lastTime = _loc4_;
  78.          }
  79.       }
  80.    }
  81.    function Init()
  82.    {
  83.       super.Init();
  84.       this.Enemy = "mole_go1/mole_go2/mole_go4";
  85.       var _loc4_ = new illusoft.utils.RectangleCheck(this.dmc.roundedRect00._x,this.dmc.roundedRect00._y,this.dmc.roundedRect00._width,this.dmc.roundedRect00._height,this.gameMC);
  86.       this.surfaces.push(_loc4_);
  87.       var cref = this;
  88.       _loc4_.onContact = function()
  89.       {
  90.          if(!cref.aniDone)
  91.          {
  92.             cref.dmc.level3ani.play();
  93.             _global.sounds.PlaySound("door");
  94.             cref.game.listenForKeys = false;
  95.             cref.character.dmc._visible = false;
  96.             cref.aniDone = true;
  97.             cref.game.camYSpeed = 0.1;
  98.             cref.game.camXSpeed = 0.1;
  99.          }
  100.          cref.character.AllowJump(false);
  101.       };
  102.       this.dynamicsEngine.addSurface(_loc4_);
  103.       this.aniDone = false;
  104.       this.dmc.level3ani.gotoAndStop(1);
  105.       this.dmc.level3ani.AniDone = function()
  106.       {
  107.          cref.game.listenForKeys = true;
  108.          cref.character.dmc._visible = true;
  109.          cref.game.camYSpeed = 0.3;
  110.          cref.game.camXSpeed = 0.2;
  111.          var _loc1_ = cref.character.dmc;
  112.          _loc1_._x = 380;
  113.          _loc1_._y = 705;
  114.          cref.character.SetMC(_loc1_);
  115.       };
  116.       this.dmc.level3ani.SetCam = function(x, y)
  117.       {
  118.          cref.game.worldPos.x += x;
  119.          cref.game.worldPos.y += y;
  120.       };
  121.       this.dmc.mole_go1.runstart = function()
  122.       {
  123.          trace("a");
  124.          _global.sounds.LoopSound("bs",100);
  125.       };
  126.       this.dmc.mole_go1.runstop = function()
  127.       {
  128.          _global.sounds.FadeVolume("bs",false,false);
  129.       };
  130.       this.dmc.mole_go2.runstart = function()
  131.       {
  132.          _global.sounds.LoopSound("bs",100);
  133.       };
  134.       this.dmc.mole_go2.runstop = function()
  135.       {
  136.          _global.sounds.FadeVolume("bs",false,false);
  137.       };
  138.       this.dmc.mole_go3.runstart = function()
  139.       {
  140.          _global.sounds.LoopSound("bs",100);
  141.       };
  142.       this.dmc.mole_go3.runstop = function()
  143.       {
  144.          _global.sounds.FadeVolume("bs",false,false);
  145.       };
  146.       this.dmc.mole_go2.Hit2 = function()
  147.       {
  148.          trace("Hit2");
  149.          cref.Hit2 = true;
  150.       };
  151.       _global.sounds.StartMusic("loop3");
  152.    }
  153.    function Close()
  154.    {
  155.       _global.sounds.FadeVolume("bs",false,false);
  156.       super.Close();
  157.    }
  158.    function LevelComplete()
  159.    {
  160.       this.levelComplete = true;
  161.       _global.sounds.FadeVolume("bs",false,false);
  162.    }
  163. }
  164.