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

  1. class illusoft.GameTile004 extends illusoft.GameTile
  2. {
  3.    var levelComplete;
  4.    var character;
  5.    var dmc;
  6.    var dynamicsEngine;
  7.    var game;
  8.    function GameTile004(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(x > 950 && x < 2100)
  18.          {
  19.             _global.sounds.LoopSound("waterpao",100);
  20.          }
  21.          else
  22.          {
  23.             _global.sounds.FadeVolume("waterpao",false,false);
  24.          }
  25.       }
  26.       var _loc4_ = this.character.dmc;
  27.       if(_loc4_.hitTest(this.dmc.square1))
  28.       {
  29.          this.dynamicsEngine.setGravity(0,5);
  30.       }
  31.       else if(_loc4_.hitTest(this.dmc.square2) || _loc4_.hitTest(this.dmc.square4) || _loc4_.hitTest(this.dmc.square7))
  32.       {
  33.          this.dynamicsEngine.setGravity(-3.5,1.9);
  34.       }
  35.       else if(_loc4_.hitTest(this.dmc.square3) || _loc4_.hitTest(this.dmc.square5) || _loc4_.hitTest(this.dmc.square6))
  36.       {
  37.          this.dynamicsEngine.setGravity(3.5,1.9);
  38.       }
  39.       else if(_loc4_.hitTest(this.dmc.square8))
  40.       {
  41.          this.dynamicsEngine.setGravity(0,-3.5);
  42.       }
  43.       else
  44.       {
  45.          this.game.NormalGravity();
  46.       }
  47.    }
  48.    function Close()
  49.    {
  50.       _global.sounds.FadeVolume("waterpao",false,false);
  51.       super.Close();
  52.    }
  53.    function LevelComplete()
  54.    {
  55.       this.levelComplete = true;
  56.       _global.sounds.FadeVolume("waterpao",false,false);
  57.    }
  58.    function Init()
  59.    {
  60.       super.Init();
  61.       _global.sounds.StartMusic("loop4");
  62.       this.game.SetUnderWater(true);
  63.       var cref = this;
  64.       var _loc4_ = 1;
  65.       while(_loc4_ <= 8)
  66.       {
  67.          this.dmc["square" + _loc4_]._visible = false;
  68.          _loc4_ = _loc4_ + 1;
  69.       }
  70.       this.dmc.ani.AniDone = function()
  71.       {
  72.          cref.game.listenForKeys = true;
  73.          cref.character.dmc._visible = true;
  74.          cref.game.camYSpeed = 0.3;
  75.          cref.game.camXSpeed = 0.2;
  76.          var _loc1_ = cref.character.dmc;
  77.          _loc1_._x = 784.3;
  78.          _loc1_._y = 1020.3;
  79.          cref.character.SetMC(_loc1_);
  80.       };
  81.       this.dmc.ani.SetCam = function(x, y)
  82.       {
  83.          cref.game.worldPos.x += x;
  84.          cref.game.worldPos.y += y;
  85.       };
  86.    }
  87.    function Start()
  88.    {
  89.       super.Start();
  90.       this.game.listenForKeys = false;
  91.       this.character.dmc._visible = false;
  92.    }
  93. }
  94.